Get documents by a single key in android couchbase lite


I am trying to get documents based on a single key which can be done in couchdb e.g. /blog/_design/docs/_view/by_date?key=“2009/01/30 18:04:11” .

The iOS version seems to be able to do it using “keys” (If non-nil, the query will fetch only the rows with the given keys." but the android version
seems to operate differently (“An optional array of document IDs. If given, only keys emitted by the documents with these IDs will be returned” -

The net being I’ve not been able to successfully query specific documents based on keys


I filed a ticket to see if we have existing test coverage for this here:

Can you update the issue and add exact steps to reproduce your problem?


  • Design doc you are using
  • Curl request(s) that reproduce the issue.


The iOS and Android docs are describing the same feature, just using different words.

What exactly is the problem you’re running into?


It was my error. I was trying to get a key “1” when the key was true. Though the difference in wording is a bit confusing, the android version makes it seem like you’re specifying document ids


we have such tests in our functional tests:

they have the same result for both Android and ios:

{ offset: 0,
total_rows: 1,
rows: [ { id: ‘cbl_views_5’, value: ‘bar’, key: ‘cbl_views_5’ } ] }
{ offset: 0,
total_rows: 3,
[ { id: ‘cbl_views_3’, value: ‘bar’, key: ‘cbl_views_3’ },
{ id: ‘cbl_views_4’, value: ‘bar’, key: ‘cbl_views_4’ },
{ id: ‘cbl_views_5’, value: ‘bar’, key: ‘cbl_views_5’ } ] }



i am creating cocuhbase lite document through code:

Map properties = new HashMap();
properties.put(“type”, “list”);
properties.put(“title”, title);
properties.put(“created_at”, currentTimeString);
properties.put(“owner”, “profile:” + userId);
properties.put(“members”, new
Document document = database.createDocument();

Can you help me to create named document as we can create in cocuhbase server like ,