incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wordit Ltd <wordi...@googlemail.com>
Subject How to pass parameters to views?
Date Mon, 06 Dec 2010 17:28:55 GMT
Can parameters be passed to views? I know you can use them in updaters.
I hoped this would work, but it did not:

function(doc, req) {
var myparam = req.query.myparam;
...

URL: .../view_name?myparam="foo"


I need to pass two parameters to a for loop which is pulling data from
an array/list.
I have data stored in the array "words".

function(doc) {
 for (i=0; i < doc.words.length;i++) {
  emit(i, doc.words[i]);
 }
}

This outputs ALL items in the array. I want to pass in A and B as
params to the for loop.
Can this be done, or is there another way to achieve it?

Thanks,

Marcus

Mime
View raw message