Skip to content

Instantly share code, notes, and snippets.

@xeptore
Created March 12, 2019 04:18
Show Gist options
  • Save xeptore/ff66c52bfdbab60bc61004771d7c9369 to your computer and use it in GitHub Desktop.
Save xeptore/ff66c52bfdbab60bc61004771d7c9369 to your computer and use it in GitHub Desktop.
add user to MongoDB
db.createUser({
user: "<name>",
pwd: "<cleartext password>",
customData: {},
roles: [
{ role: "<role>", db: "<database>" } | "<role>"
],
authenticationRestrictions: [
{
clientSource: ["<IP>" | "<CIDR range>"],
serverAddress: ["<IP>" | "<CIDR range>"]
},
],
mechanisms: [ "<SCRAM-SHA-1|SCRAM-SHA-256>"],
passwordDigestor: "<server|client>"
})
@xeptore
Copy link
Author

xeptore commented Mar 12, 2019

a list of biult-in roles: built-in-roles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment