couchdb - how to filter view with "any" comparison? -


i have database in couchdb contain 4 documents... here sample
, here the document source:

  1. {"_id": "...","gender": "f","hat": "blue"}
  2. {"_id": "...","gender": "f","hat": "red"}
  3. {"_id": "...","gender": "m","hat": "blue"}
  4. {"_id": "...","gender": "m","hat": "red"}

here view:

function(doc) {    emit([doc.gender,doc.hat], doc); } 

but want fetch data following case :

  1. select gender 'f' , kind of hat (done | sample)
  2. 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

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -