Created
January 16, 2013 23:16
-
-
Save ebarendt/4551927 to your computer and use it in GitHub Desktop.
Map reduce trial for MongoDB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var m = function() { | |
emit(this.id, {opaqueId: this.opaque_id}); | |
} | |
var r = function(key, values) { | |
var all = []; | |
values.forEach(function(x) { | |
all.push(x.opaqueId); | |
}); | |
return {"opaqueId": all.join(", ")}; | |
} | |
res = db.activities.mapReduce(m, r, { out: 'example' }); | |
db.example.find().pretty(); | |
# { "_id" : null, | |
# "value" : { | |
# "opaqueId" : "Pkkd, ckkd, Gkkd" | |
# } | |
# } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment