Skip to content

Instantly share code, notes, and snippets.

@normgraham
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save normgraham/3163401e75e35d62cbf1 to your computer and use it in GitHub Desktop.

Select an option

Save normgraham/3163401e75e35d62cbf1 to your computer and use it in GitHub Desktop.
Print documents from system.users collections in all databases
var listUsers = function () {
db.adminCommand({"listDatabases":1}).databases.forEach(function(doc) {
print(doc.name + ":");
db.getSiblingDB(doc.name).getCollection("system.users").find().forEach(printjson);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment