Hi madhav,
Typically, you create a view where the key is the data you want to
filter on, and the value is the data you want to retrieve.
eg: If you have a big db of people, and you want to be able to look up
people by their phone number, and will want to display at least their names:
map = function(doc) { emit(doc.phone, doc.name); }
To find the name of a person who has the phone number 12345678, send a
request to:
http://localhost:5984/dbpeople/_design/dbpeople/_view/by_phone_number?key=12345678
If you want to see more than just their name:
http://localhost:5984/dbpeople/_design/dbpeople/_view/by_phone_number?key=12345678&include_docs=true
(the include_docs parameter will include the entire document in the
returned data.)
On 10/02/2010 4:44 PM, madhav sharma wrote:
hi everyone
I am couchdb for one of my project and i am stuck at a place where i need
your help.
My use case of problem is that i have a set of documents which have same
field with different value and i need to get the value of field (say name)
from a document with id (say information) , and i want this mapfunction to
be generic so that i can call this with different document id and get the
the field value out of it.
In sql it can just be( select name from Table where id = 1233 ) so any
help is appreciated
Thanks