Query options

In Java there are methods for setting the start and end document ID key (setStartkeyDocID() setEndkeyDocID()) and there are methods to set the key (setKey() and setKeys()) and key range (setRange(), setRangeStart(), setRangeEnd(), etc.). I am unclear as to the difference? When I setup a view the emit() is called with a key and either null or a value. When querying the data is this the keyDocID or the key?

1 Answer

« Back to question.

Hello,
The emit is the "key" of the index that you are using in your query.
This is what you use with the setKey setKeys setRange.
The docID is the "ID" that you are using to store the document itself when you do a client.set(ID, 0, value ) for example.
The docid is often used when you do pagination. Take a look to this document :
http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views-writi...
Let me know if you need more information