Skip to content

Instantly share code, notes, and snippets.

@RICH0423
Last active December 13, 2016 07:10
Show Gist options
  • Select an option

  • Save RICH0423/b5bd77cd70cc7bac357efe3dc6c6adc7 to your computer and use it in GitHub Desktop.

Select an option

Save RICH0423/b5bd77cd70cc7bac357efe3dc6c6adc7 to your computer and use it in GitHub Desktop.
MongoDB add backup role
> db.getUsers()
[
{
"_id" : "admin.ssir-admin",
"user" : "ssir-admin",
"db" : "admin",
"roles" : [
{
"role" : "readWrite",
"db" : "admin"
},
{
"role" : "userAdminAnyDatabase",
"db" : "admin"
}
]
}
]
db.updateUser( "ssir-admin",
{
roles : [
{
"role" : "readWrite",
"db" : "admin"
},
{
"role" : "userAdminAnyDatabase",
"db" : "admin"
},
{
"role" : "backup",
"db" : "admin"
}
]
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment