incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From afters <afters.m...@gmail.com>
Subject Re: Can I get just the keys from a view? [SEC=UNCLASSIFIED]
Date Thu, 17 Jun 2010 08:18:09 GMT
You should read this:
http://books.couchdb.org/relax/design-documents/lists

On 17 June 2010 03:42, Lowry, Matthew <Matthew.Lowry@dsto.defence.gov.au>wrote:

> Yes - I believe a list function is exactly what is needed.
> I wasn't aware of this feature. It gets very little mention in the wiki;
> all I could find was this page:
>
> http://wiki.apache.org/couchdb/Formatting_with_Show_and_List
>
> which doesn't seem to be linked into the rest of the wiki pages - I only
> found it by searching for "_list".
>
> Anyhoo, if I understand the documentation correctly one could have a
> list function along the lines of
>
> function(head, req) {
>  var row;
>  while(row = getRow()) {
>    send(null);
>  }
> }
>
> and then apply that on any view to, as you say, crop the values and
> leave the keys.
>
> Thanks for the advice folks.
>
>
> -----Original Message-----
> From: afters [mailto:afters.mail@gmail.com]
> Sent: Tuesday, 15 June 2010 5:06 PM
> To: user@couchdb.apache.org
> Subject: Re: Can I get just the keys from a view? [SEC=UNCLASSIFIED]
>
> I'm fairly new to couch myself, but here goes:
>
> You could use a list function that would crop the values and leave the
> keys.
>
> Also, you could write a reduce function that does the same - just query
> the view with 'group=true' so each view-doc gets its own reduce.
>
>
> a.
>
> On 15 June 2010 05:26, Lowry, Matthew
> <Matthew.Lowry@dsto.defence.gov.au>
> wrote:
>
> > Hi folks. A Couch newbie here with a question regarding the view API.
> >
> > Is there any way that I can query a view and get just the key for each
>
> > row, and omit the value?
> >
> > The reason I ask is I'm working with a view that generates a massive
> > amount of data - each document in the database generates many hundreds
>
> > of rows in the view. Each row has a large value object. But all I want
>
> > to do is get the keys. So it's wasting a massive amount of time and
> > resources, both client and server side, to have to pull both the key
> > and value object for every row in the view when all I want to see is
> > the key.
> >
> > So is there actually a mechanism in the view API to pull just the key
> > from each row of a view? And if not, why not? That would be curiously
> > asymmetrical with the document API, which allows me to get the IDs of
> > all the documents without requesting the documents themselves.
> >
> > Cheers.
> >
> > IMPORTANT: This email remains the property of the Department of
> > Defence and is subject to the jurisdiction of section 70 of the Crimes
>
> > Act 1914. If you have received this email in error, you are requested
> > to contact the sender and delete the email.
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message