Skip to content

Instantly share code, notes, and snippets.

@daimaou92
Created September 26, 2018 06:42
Show Gist options
  • Save daimaou92/15b4c06bce638715a2b7b20d6bfbda6a to your computer and use it in GitHub Desktop.
Save daimaou92/15b4c06bce638715a2b7b20d6bfbda6a to your computer and use it in GitHub Desktop.
var mr = db.runCommand({"mapreduce": "collName", "map": function(){ for(var key in this){ emit(key, null); } }, "reduce": function(key, stuff){ return null; }, "out": "collName"+ "_keys" })
db[mr.result].distinct("_id")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment