Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var map = function() {
- if(myMap.has(this.user_id)
- myMap.set(this.user_id, myMap.get(this.user_id) + 1)
- else
- myMap.set(this.user_id, 1)
- emit(this.user_id, 1);
- };
- var reduce = function(k,vals) { return 1; };
- collection.mapReduce(map, reduce, {
- scope: {
- myMap: new Map() // is this possible?
- }
- });
Add Comment
Please, Sign In to add comment