mongodump -d myDatabase -o ~/backups/first_backup
$mongod --auth
db.createUser({user:"admin_name", pwd:"1234",roles:["readWrite","dbAdmin"]})
If you want to add without roles (optional):
db.createUser({user:"admin_name", pwd:"1234", roles:[]}) to check if authenticated or not:
db.auth("admin_name", "1234") it should give you:
1 else :
Error: Authentication failed. 0
mongo restore
install mongo
https://docs.mongodb.com/v3.0/tutorial/install-mongodb-on-amazon/
$mongod --auth
db.createUser({user:"admin_name", pwd:"1234",roles:["readWrite","dbAdmin"]})
If you want to add without roles (optional):
db.createUser({user:"admin_name", pwd:"1234", roles:[]}) to check if authenticated or not:
db.auth("admin_name", "1234") it should give you:
1 else :
Error: Authentication failed. 0
mongo restore
mongorestore dump-2013-10-25/https://docs.mongodb.com/manual/tutorial/backup-and-restore-tools/
install mongo
https://docs.mongodb.com/v3.0/tutorial/install-mongodb-on-amazon/