Skip to content Skip to sidebar Skip to footer

Query Multiple Keys In Couchbase Lite View

Hi I am new to couchbase/couchbase-lite and i try to query a view with multiple keys without success. Her is how the map function looks: public void map(Map d

Solution 1:

Two emits doesn't work. If you give a ArrayList in setKeys() method, each key in the List match the each key in emit. If you want to match two keys, add keys ArrayList into another List. Then pass it to setKeys() method. Like this,

List<Object> keys = newArrayList<Object>();
List<Object> allKeys = newArrayList<Object>();
keys.add(key_1);
if (key_2 != null) keys.add(key_2);
allKeys.add(keys);
query.setKeys(allKeys);
results = query.run();

Solution 2:

This is the solution, We need to add keys into another List<Object>https://github.com/couchbase/couchbase-lite-android/issues/740

Post a Comment for "Query Multiple Keys In Couchbase Lite View"