incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rodd Snook <roddsn...@gmail.com>
Subject Re: parametrized view generation
Date Wed, 10 Feb 2010 06:20:14 GMT
On Wed, Feb 10, 2010 at 4:56 PM, Mano <manokaran@gmail.com> wrote:
>
> On Wed, Feb 10, 2010 at 11:14 AM, madhav sharma <mail.madhavsharma@gmail.com
> > 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]

Mime
View raw message