Hi i need to query a view that indexes a compound key either by a single
key within the compound key (only the first key )of multiple keys (the
first and the second key). To be more specific here is how my map function
looks (Android).
public void map(Map<String, Object> doc, Emitter emitter) {
if (doc.get("type").equals("forms")) {
List<Object> keys = new ArrayList<Object>();
keys.add(doc.get("parent_uuid"));
keys.add(doc.get("uuid"));
emitter.emit(keys, null);
}
}
I am emitting a compound key containing the uuid of a document and the uuid
of its parent. Basically i need to retrieve either a single document by
its uuid (32 bit string) or all documents belonging to a specific parent.
i am able to manage the query for a single document by its uuid like so:
View view = database.getView("forms");
QueryOptions options = new QueryOptions();
List<Object> keys = new ArrayList<Object>();
keys.add(new Object[]{parent_uuid, uuid});
options.setKeys(keys);
resources = view.queryWithOptions(opts);
However, how would i query all documents that belong to a certain parent.
Would that be possible with the above map function? Or would i need a
second map function?
the following approach obviously does not work:
List<Object> keys = new ArrayList<Object>();
keys.add(new Object[]{parent_uuid, new HashMap<String, Object>()});
--
You received this message because you are subscribed to the Google Groups
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/mobile-couchbase/d2db2e74-8cda-45d7-94c4-30d756924c3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.