couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Woodward <>
Subject Re: Map/Reduce Question
Date Mon, 06 Dec 2010 22:06:16 GMT
On Mon, Dec 6, 2010 at 1:32 PM, Matthew Woodward <>wrote:

> Is there a way to pass a specific last name as the key in the URL and have
> the results be the example I gave in my previous message, but only for the
> specific last name provided as the key?

Sorry, keep thinking of better ways to explain this.

If I use a specific value for the regex in a match function, it works fine,
but I'd like to use the key in the URL as the value against which to match.

For example here's the map function:

"map":"function(doc) {
        var lastNameMatch = doc['lastName'].match(/Woodward/);
        if (lastNameMatch) {
            emit([doc.lastName, doc.firstName, doc.middleInitial], null);

So what I'd like to be able to do is include key="Woodward" in the URL and
have the value of the key in the URL be what's used in my match regex, or if
there's a different way to do exact matches (because in this case I will
always be pulling by exact key matches) and still have the rest of this work
as described before, that's fine as well.
Matthew Woodward / Twitter: @mpwoodward

Please do not send me proprietary file formats such as Word, PowerPoint,
etc. as attachments.

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