I am quite new to CouchDB and have a very basic question:
Is there any possibility to pass a variable from the client into the map function, e.g.:
function (doc, params) {
if (doc.property > params.property) emit(doc, null);
}
Thanks for your help,
Christian
While Dominic’s answer is true, the example in the actual question can probably be implemented as a map function with an appropriate key and a query that includes a
startkey. So if you want the functionality that you show in your example you should change your view to this:And then your query would become:
Which would give you what your example suggests you’re after.
This is the key (puns are funny) to working with CouchDB: create views that allow you to select subsets of the view based on the key using either
key,keysor some combination ofstartkeyand/orendkey