Couchbase Lite .NET 1.4, Multiple Key Query

Hello,

maybe I am not the first to ask this question, but I could not find an answer to this problem yet.
I have created a view which emits multiple keys:

ParametersByTestCase.SetMap(
(doc, emit) =>
{
if (!doc[“Type”].ToString().Equals(TestCaseModel.TYPE)) return;
var keys = new List<object>
{
doc["_id"],
doc[“TestDefId”]
};
emit(keys, doc[“Params”]);
},
“1.0”);

now i would like to query for a certain key but I do not get any results. From the forum I found this solution:

var key = new List { testDefId };
var keys = new List<object> { key };
query.Keys = keys;
query.Run();

which always returns no results (and the key is definitly in the index).

another approach i found was this:

query.StartKey = new List<object> { testDefId };
query.EndKey = new List<object> { testDefId, new Dictionary<string, object>() };
query.Run();

which also does not work… what am i doing wrong?

Ty & BR
Hannes

Emitting an array as the key does not do what you’re expecting it to do. It creates a compound key, which you can think of as a primary and secondary key. If you want to emit multiple independent keys, so you can look up this value by any of them, then call emit multiple times, once with each key.