Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AlexNolasco/0051b6c1ce3e1eb499c9977c076f764f to your computer and use it in GitHub Desktop.
Save AlexNolasco/0051b6c1ce3e1eb499c9977c076f764f to your computer and use it in GitHub Desktop.
MongoDB Get Collection Record Numbers
db.getCollectionNames().forEach(function(collection) {
records = db[collection].count()
if (records > 0) {
print( collection + ": " + records);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment