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<String, Object> doc, Emitter emitter) {
if (doc.get("type").equals("my_type") {
List<Object> keys = new ArrayList<Object>();
keys.add(doc.get("key_1"));
keys.add(doc.get("key_2"));
emitter.emit(keys, null);
}
}
My problem is that i need to query the view either only with key_1 or with a combination of key_1 and key_2 like so
List<Object> keys = new ArrayList<Object>();
keys.add(key_1);
if (key_2 != null) keys.add(key_2);
query.setKeys(keys);
results = query.run()
However the results are always empty. Do i overlook anything?