Reputation: 114
So I have searched a lot but I don't currently have a solution for this. Following is the query to get documents from cloudant (couchDB) database based on multiple keys ("key-1" and "key-2").
db.getViewRequestBuilder("example", "foo").newRequest(Key.Type
.STRING,
Object.class).includeDocs(false).keys("key-1", "key-2").build()
.getResponse().getDocs();
This doesn't seem to work if I just pass a list of keys. I have a List
<String> keys
that I would like to pass here and get all the docs. Does anyone know the simplest way to do this?
Upvotes: 0
Views: 794
Reputation: 114
I found a solution to this finally:
return db.getAllDocsRequestBuilder()
.includeDocs(true)
.keys(keys.toArray(new String[keys.size()]))
.build().getResponse().getDocsAs(Object.class);
Hope it helps others as well.
Upvotes: 1