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” http://guide.couchdb.org/draft/views.html#one .

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." http://couchbase.github.io/couchbase-lite-ios/docs/html/interfaceCBLQuery.html#a0f1d7f8f62d04e6ee016d7d518d4dbcb) 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” - http://developer.couchbase.com/mobile/develop/guides/couchbase-lite/native-api/query/index.html#creating)

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?

Including:

  • 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:
https://github.com/couchbaselabs/cblite-tests/blob/master/tests/cbl-views.js#L86-L96

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,
rows:
[ { 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’ } ] }

hi,

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
ArrayList());
Document document = database.createDocument();
document.putProperties(properties);

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

Client.set(“doument_name”,“document_value”);