Skip to content

Instantly share code, notes, and snippets.

@townie
Last active August 31, 2017 21:58
Show Gist options
  • Save townie/402bc44f63994f3cc1e1a8e9704ad5ba to your computer and use it in GitHub Desktop.
Save townie/402bc44f63994f3cc1e1a8e9704ad5ba to your computer and use it in GitHub Desktop.
Get all of the collections and records out of a database
// mongo 127.0.0.1/MMApp collect.js >> collects.txt
var collects= db.getCollectionNames();
collects.forEach(function(name, i) {
var c = db[name].find();
while(c.hasNext()) {
printjson(c.next())
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment