Created
February 21, 2017 19:55
-
-
Save arthuralvim/022c0ab60a05c948404787f8efa6f387 to your computer and use it in GitHub Desktop.
Get all keys for a MongoDB collection.
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
mr = db.runCommand({ | |
"mapreduce" : "extracao_unimed", | |
"map" : function() { | |
for (var key in this) { emit(key, null); } | |
}, | |
"reduce" : function(key, stuff) { return null; }, | |
"out": "extracao_unimed" + "_keys" | |
}) | |
db[mr.result].distinct("_id") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment