Hi all,

Finding CouchDB very useful and flexible for some of the workflow stuff I am
doing to clean up bibliographic data.
I have hit a wall in my feeble understanding  of map reduce and need some
help.

I have a database with documents that have varying number of fields.
I need to create a view that displays

{ field_name1 : count, ..... }

i.e. a report that displays how many times a field occurs in the db.
It's like a word frequency vector in Lucene except for the fact that these
are field names.

So I am missing something basic but I need to loop over all keys of a doc
without knowing their names in advance.
so I do something like

var x = {}
for ( var k in doc.keys ) {
 x[k] = 1
}
emit ( x, 1 ) <---- is this the right thing to emit ?


newbie questions
a) whats the syntax to access all keys of a doc
b) what's the right thing to emit
c) what do I do in the reduce phase ?

Thanks much,


Nitin

37% of all statistics are made up on the spot
-------------------------------------------------------------------------------------
Nitin Borwankar
[email protected]

Reply via email to