On Wed, Feb 10, 2010 at 4:56 PM, Mano <[email protected]> wrote: > > On Wed, Feb 10, 2010 at 11:14 AM, madhav sharma <[email protected] > > 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 > > > > The map function can: > > emit( [doc.name, doc._id], doc). > > You can query this view with a 'key' of [name, 1233]. > > regds, > mano
I don't think that's going to do what the OP wants, which is picking a particular field out of the document. It's also going to create a huge view, because it contains the whole document. I think what he's looking for is: emit(doc._id, doc.name) [disclaimer: I'm totally new at CouchDb too]
