add group_level=1 to get the unique foo's.
On Fri, Dec 3, 2010 at 9:41 AM, Robert Newson <[email protected]> wrote: > Matthew, > > Your original message implied that you might have duplicates but I > didn't notice that you had documents with the same key but different > contents (and there isn't one in your example). > > You can't reduce your way out of that, I think. What you can do instead is; > > map: > > function(doc) { > if (doc.foo != '' && (doc.bar != '' || doc.baz != '')) { > emit([doc.foo, doc.bar, doc.baz], null); > } > } > > reduce: > > function(keys, values, rereduce) { > return null; > } > > When queried with group=true, you'll get one row for every unique > combination of foo, bar and baz. > > B. > > > > > On Thu, Dec 2, 2010 at 11:57 PM, Matthew Woodward <[email protected]> > wrote: >> On Thu, Dec 2, 2010 at 3:50 PM, Randall Leeds <[email protected]>wrote: >> >>> I think you may want to play w the ?group_level query parameter. >>> >> >> Thanks--messed with that but since my keys weren't unique across records it >> didn't seem to make a difference. I'll look back into that though. >> >> -- >> Matthew Woodward >> [email protected] >> http://blog.mattwoodward.com >> identi.ca / Twitter: @mpwoodward >> >> Please do not send me proprietary file formats such as Word, PowerPoint, >> etc. as attachments. >> http://www.gnu.org/philosophy/no-word-attachments.html >> >
