If anyone has a quick example of doing a map reduce with multiple keys
they can post, it would be appreciated.
> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>
>
Can someone PLEASE just post a complete example like there is for
group by?
Much appreciated.
r = function(obj, prev) { prev.csum += parseFloat(obj.value); ccount+
+; }
db.vector.group({key: {site:true, goal:true, tags:true}, cond: {value:
{ $exists : true }}, reduce: r, initial: {csum: 0, ccount: 0}});
and this works fine but craps out at 10,000 unique rows.
I tried to convert this to map reduce based on what you said,
m = function() { emit{site:1, goal:1, tags:1} }
r = function(k,v) { var csum = 0; var ccount = 0; for(var i in v)
{ csum += parseFloat(v[i].value); ccount++ }; return {csum, ccount} }
and it didnt work. As I mentioned I dont have a complete example to
go off to do this so not sure how to proceed.
Ive READ the docs multiple times and looked at the basic examples.
This is why im asking someone to give me a BASIC EXAMPLE for a multi-
key group by using map reduce.
Can someone provide this?
On Apr 1, 4:12 pm, Eliot Horowitz <eliothorow...@gmail.com> wrote:
> You should read the docs on emit and look at the basic examplex
> this is wrong:
>
>
>
> > m = function() { emit{site:1, goal:1, tags:1} }
> try
> > m = function() { emit{site:1, goal:1 } , { tags:1} }