Skip to content

Instantly share code, notes, and snippets.

@danhanfry
Last active January 10, 2017 16:28
Show Gist options
  • Save danhanfry/0372709b4683884c589fad505ac5a04e to your computer and use it in GitHub Desktop.
Save danhanfry/0372709b4683884c589fad505ac5a04e to your computer and use it in GitHub Desktop.
Mongoose: mongodb://username:password@host:port/database
$ mongo
> use admin
> db.createUser({user:"someadmin",pwd:"secret", roles:[{role:"root",db:"admin"}]})
> exit
$ mongo
> use some_db
> db.createUser({user: "mongouser",pwd: "someothersecret",roles: ["readWrite"]})
restart Mongod
mongod --auth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment