Skip to content

Instantly share code, notes, and snippets.

@nucklehead
Last active October 9, 2017 00:27
Show Gist options
  • Save nucklehead/8f7b75a43de856d69f40b44d7354ace8 to your computer and use it in GitHub Desktop.
Save nucklehead/8f7b75a43de856d69f40b44d7354ace8 to your computer and use it in GitHub Desktop.
#!/bin/bash -ex
rm -rf db
mkdir db
mongod --dbpath db &
sleep 1
mongo mydatabase --eval 'db.createUser({user: "admin", pwd: "password", roles: [{ role: "userAdminAnyDatabase", db: "admin" }]})'
sleep 1
pkill mongod
mongod --auth --dbpath db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment