couchdb - how to filter view with "any" comparison? -
i have database in couchdb contain 4 documents... here sample
, here the document source:
{"_id": "...","gender": "f","hat": "blue"}
{"_id": "...","gender": "f","hat": "red"}
{"_id": "...","gender": "m","hat": "blue"}
{"_id": "...","gender": "m","hat": "red"}
here view:
function(doc) { emit([doc.gender,doc.hat], doc); }
but want fetch data following case :
- select gender 'f' , kind of hat (done | sample)
- select kind of gender , have "red' hat (stack)
how make second point works??
how filter view "any" comparison ??
for second point, need view this;
function(doc) { emit(doc.hat, null); }
query ?key="red".
note: emit null save space in index. query ?include_docs=true docs back.
Comments
Post a Comment