Couchbase Lite .NET 1.4, Multiple Key Query


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:

(doc, emit) =>
if (!doc[“Type”].ToString().Equals(TestCaseModel.TYPE)) return;
var keys = new List<object>
emit(keys, doc[“Params”]);

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;

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>() };

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

Ty & BR

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.