mapreduce - couchDB- complex query on a view -


i using cloudantdb , want query view looks this

function (doc) { if(doc.name !== undefined){ emit([doc.name, doc.age], doc); }

what should correct way result if have list of names(i using option 'keys=[]' it) , range of age(for startkey , endkey should used)

example: want persons having name "john" or "mark" or "joseph" or "santosh" , lie between age limit 20 30.

if go list of names, query should keys=["john", ....] , if go age query should use startkey , endkey

i want both :)

thanks

unfortunately, can't so. using keys parameter query documents specified key. example, can't send keys=["john","mark"]&startkey=[null,20]&endkey=[{},30]. query , only return document having name john , mark null age.

in question specified couchdb if using cloudant, index query might interesting you.

you have :

{   "selector": {     "$and": [       {         "name": {            "$in":["mark","john"]          }       },       {         "year": {           "$gt": 20,           "$lt": 30         }       }     ]   },   "fields": [     "name",     "age"   ] } 

as couchdb, need either separate request (1 request age , 1 people) or filtering locally.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -