Reputation: 147
I am wondering if i could filter data in Couchdb similar with IN in MySQL. For example the map function is :
function(doc) {
emit(doc.idWord, [doc.idTwitterData, doc.tf*doc.idf]);
}
I want to select only documents that have idWord with values 1 or 5 for example. I tried to set startkey=1 and endkey=5 but it is not working.
Upvotes: 0
Views: 156
Reputation: 3690
It's very simple. All you need to query is ?keys=[1,5]
. This will fetch all the records with the idWord equal to 1 or 5. You might want to encode the [ ]
As an addition: you use the parameters startkey and endkey if you are doing a ranged query. Here is a good explanation how a ranged query works.
Upvotes: 1