CouchDb view - key in a list?

Up vote 0 down vote favorite share g+ share fb share tw.

I Want to query CouchDB and I have a specific need : my query should return the name field of documents corresponding to this condition : the id is equal or contained in a document filed (a list). For example, the field output is the following : "output": "doc_s100", "doc_s101", "doc_s102", "doc_s103", , I want to get all the documents having in their output field "doc_s102" for example. I wrote a view in a design document : "backward_by_docid": { "map": "function(doc) {if(doc.

Output) emit(doc. Output, doc. Name)}" } but this view works only when I have a unique value in the output field.

How can I resolve this query? Thanks! Couchdb link|improve this question asked Mar 12 at 17:06user16228462.

You have to iterate over the array: if(doc. Output) { for (var curOutput in doc. Output) { emit (doc.

OutputcurOutput,doc. Name); } } make sure that output always is an array (at least ) .. and, of course use key="xx" instead key="xxx".

Thanks for the answer, it work! – user162284 Mar 15 at 16:26.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions