Guest User

Untitled

a guest
Oct 17th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. var map = function() {
  2. if(myMap.has(this.user_id)
  3. myMap.set(this.user_id, myMap.get(this.user_id) + 1)
  4. else
  5. myMap.set(this.user_id, 1)
  6.  
  7. emit(this.user_id, 1);
  8. };
  9.  
  10. var reduce = function(k,vals) { return 1; };
  11.  
  12.  
  13. collection.mapReduce(map, reduce, {
  14. scope: {
  15. myMap: new Map() // is this possible?
  16. }
  17. });
Add Comment
Please, Sign In to add comment