Skip to content

Instantly share code, notes, and snippets.

@dafyddcrosby
Created September 3, 2013 17:43
Show Gist options
  • Save dafyddcrosby/6427098 to your computer and use it in GitHub Desktop.
Save dafyddcrosby/6427098 to your computer and use it in GitHub Desktop.
Validate all collections in MongoDB
conn = new Mongo();
dblist = conn.getDBs();
dblist.databases.forEach(function(x){
db = db.getSiblingDB(x.name);
db.getCollectionNames().forEach(function(c){
printjson(db.getCollection(c).validate())
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment