Composite key with CouchDB, searching for multiple entries

I know that you can pass a key or range to return entries in CouchDB, but I want to do something like this. Find the X entries that are the X values.

So, for example, in regular SQL, let's say I wanted to return records with identifiers that are 5, 7, 29, 102. I would do something like this:

SELECT * FROM sometable WHERE id = 5 OR id = 7 or id = 29 or id = 102

Is it possible to do this in CouchDB, where I drop all the values ​​that I want to find in the key array, and then CouchDB looks for all those entries that can exist in the "key parameter"?

+5
source share
2 answers

POST Wiki CouchDB. .

{"keys": ["key1", "key2", ...]}

, POST .

, GET keys. , _all_docs :

/DB/_all_docs?keys=["ID1","ID2"]&include_docs=true

, URL-, :

/DB/_all_docs?keys=%5B%22ID1%22,%22ID2%22%5D&include_docs=true

, , _all_docs doc. , .

+4

. _list .

+2

All Articles