Created
May 16, 2018 14:33
-
-
Save sarjarapu/235c8d7abe248e4c4fd05b7b14abe0a0 to your computer and use it in GitHub Desktop.
A bash script to create a user with readWrite role on the social database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mongo admin --port 28000 -u user -p password --authenticationDatabase admin <<EOF | |
db.createUser({user: 'app_user', pwd: 'password', roles: [{role: 'readWrite', db: 'social'}]}) | |
EOF | |
# The output of above command | |
# MongoDB shell version v3.6.2 | |
# connecting to: mongodb://127.0.0.1:28000/ | |
# MongoDB server version: 3.6.2 | |
# Successfully added user: { | |
# "user" : "app_user", | |
# "roles" : [ | |
# { | |
# "role" : "readWrite", | |
# "db" : "social" | |
# } | |
# ] | |
# } | |
# bye |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment