incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steffen Mutter <stef...@webanimations.de>
Subject Help for reduce function to get view working as needed...
Date Sat, 29 Jan 2011 17:14:48 GMT
Hello,

I need some help to write a function to reduce a view.
The view actually looks like this:

function(doc) {
 emit(doc.heim,null);
 emit(doc.gast,null);
}

The reduce function looks actually like this:

function(keys, values) {
  return true;
}

The output is nearly the way I want it, but I want to reduce the output,
so that if there is a single (!) number at the end of the key, I want to
cut it off and trim the string if there are spaces left.

The thing behind it is that the CouchDB stores all the matches of the
german handball federation and some of the teams have a number behind
the name of the club, so the view looks like this actually:

"SG Stutensee" true
"SG Stutensee 2"  true
"SG Stutensee 3"  true
"SG Stutensee 4"  true

what I want is, that there's only
"SG Stutensee" true
left, so that I have only (once) the name of the club left.

The next thing is, how to write a view to get all the games the *club*
playes in, so that
"SG Stutensee" would match to all 4 teams.

Kind regards from Germany,
Steffen

Mime
View raw message