Skip to content

Instantly share code, notes, and snippets.

@zbitname
Created May 18, 2016 12:26
Show Gist options
  • Save zbitname/abeee56e142938d8a5ddea2e16ac848b to your computer and use it in GitHub Desktop.
Save zbitname/abeee56e142938d8a5ddea2e16ac848b to your computer and use it in GitHub Desktop.
How many times will be called reduce function for collection with 1 object?
db.for_map_reduce.insert({name: 'Jane'})
db.for_map_reduce.mapReduce(
function() {
emit(null, this.name);
},
function(key, names) {
return names.length;
},
{
out: {
inline: 1
},
query: {},
finalize: function(key, value) {
return value;
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment