couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Carey" <>
Subject Re: newbie help on issue of passing arguments to a view
Date Thu, 16 Oct 2008 14:21:38 GMT
>  I have set up a test server and I am able to store and call simple views
> like:
> function(doc) {   if (doc.FolkCde == 'S')  emit(doc.Latitude, doc.Longitude)
> }
> However,  I am curious if it's possible for couchdb to be sent arguments to
> a view?  For example could I do something like:
> ...:5984/lith/_view/test/v2/Mn  where the "Mn" argument is passed in and
> used for the doc.FolkCdr comparison?

Not with the view you've defined, but you could try something like
function (doc) {
  emit( [doc.FolkCde,, doc.lng], doc._id );

and then query it with

where the {} in the endkey sort very late

The emit above emits the doc id rather than the doc itself as you said
you've got very large quantities of data. Emitting the doc could make
the view very large.

> couchdb:   semi-dynamic and semi-structured data, static queries
> RDMS:  semi-static (and well structured) data, dynamic queries

Sounds reasonable, I've heard others describe it this way too.


View raw message