Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Set variables
- USERNAME=$MONGODB_USERNAME
- PASSWORD=$MONGODB_PASSWORD
- DB_NAME=$MONGODB_DBNAME
- # Create User
- mongo $DB_NAME --eval "db.createUser({user: '$USERNAME',pwd: '$PASSWORD',roles: [{role: 'readWrite',db: '$DB_NAME'}]});"
- # Create Index
- mongo $DB_NAME --eval "db.someCollection.createIndex({'nsA': 1, 'nsB': 1, 'counterValue': 1});"
- # Create index
- mongo $DB_NAME --eval "db.someCollection2.createIndex({'ns': 1, 'js': 1})"
Add Comment
Please, Sign In to add comment