if your ids are strings your query parameter should be ?keys=["7", "10"]
On Thu, Jan 1, 2015 at 11:01 PM, Mic <[email protected]> wrote: > Hi, > > I have the following example document in CouchDB stored: > > *{ > "_id": "10", > "_rev": "3-5288068d2c4ef3e6a9d3f8ff4e3377dd", > "sub_name": "B01", > "name": "A", > "pos": 1932523, > "s_type": 1, > }* > > The map function looks in the following way: > > *function(doc) { > emit(doc._id, {position: doc.pos}); > }* > > and the view returns the following results. > > > *http://localhost:5984/test/_design/t/_view/by_doc_ids > <http://localhost:5984/test/_design/t/_view/by_doc_ids>* > > *{"total_rows":5,"offset":0,"rows":[ > {"id":"10","key":"10","value":{"position":1932523}}, > {"id":"14","key":"14","value":{"position":667214}}, > {"id":"7","key":"7","value":{"position":828288}}, > {"id":"8","key":"8","value":{"position":171878}}, > {"id":"9","key":"9","value":{"position":871963}} > ]}* > > However, *http://localhost:5984/test/_design/t/_view/by_doc_ids > <http://localhost:5984/test/_design/t/_view/by_doc_ids>?id=[7,10]* > returns all of them. > > {"total_rows":5,"offset":0,"rows":[ > {"id":"10","key":"10","value":{"position":1932523}}, > {"id":"14","key":"14","value":{"position":667214}}, > {"id":"7","key":"7","value":{"position":828288}}, > {"id":"8","key":"8","value":{"position":171878}}, > {"id":"9","key":"9","value":{"position":871963}} > ]} > > and *http://localhost:5984/test/_design/t/_view/by_doc_ids > <http://localhost:5984/test/_design/t/_view/by_doc_ids>?keys=[7,10] > *returns nothing: > > *{"total_rows":5,"offset":0,"rows":[ > > ]}* > > How do I get only ids with 7 and 10? > > *{"id":"7","key":"7","value":{"position":828288}}* > > *{"id":"10","key":"10","value":{"position":1932523}}* > > Thank you in advance. > > Mic >
