I am trying to get a simple map reduce working in MongoVUE, but it doesn't return any results, I just want to get it to output the count of each userID just so I can have a working example to build from.
function Map() {
emit( this.UpdatedBy.UserId, {"count": 1} );
}
function Reduce(key, values) {
var result = {count: 0};
values.forEach(function(value) {
result.count += value.count;
});
return result;
}
function Finalize(key, reduced) {
/*
reduced = Transform-to-Desired-Form(reduced);
*/
return reduced;
}
And the output is set to inline.
This is the tutorial I am working from, but I just want to apply a simple count to start off with http://www.mongovue.com/2010/11/03/yet-another-mongodb-map-reduce-tutorial/
function() {
emit( this.UpdatedBy.UserId, 1 );
};
function(key, values) {
var result = 0;
values.forEach(function(value) {
result += value;
});
return result;
};
Here is how I got it to work for anyone who needs a simple example on how to group and count a user Id.