I'd run something like:
opts = { your filter conditions here }
map_function = %Q( function() {
emit( this.date, 1);
} )
reduce_function = %Q( function(key, values) {
var total = 0;
for ( var i=0; i<values.length; i++ ) {
total += values[i];
}
return total;
})
MyModel.collection.map_reduce( map_function, reduce_function, opts )
You'll get a list of documents where _id is date, and value is the count.
Nothing MM related, iterate over it as defined in Mongo Ruby Driver documentation.
> --
> You received this message because you are subscribed to the Google
> Groups "MongoMapper" group.
> For more options, visit this group at
> http://groups.google.com/group/mongomapper?hl=en?hl=en