diff options
Diffstat (limited to 'dotfiles/cheat/mongodb')
-rw-r--r-- | dotfiles/cheat/mongodb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/dotfiles/cheat/mongodb b/dotfiles/cheat/mongodb index 54b8652..d7a7d42 100644 --- a/dotfiles/cheat/mongodb +++ b/dotfiles/cheat/mongodb @@ -1,10 +1,21 @@ +# Admin user full +use admin +db.createUser({user:"admin", pwd:"admin", roles: ["userAdminAnyDatabase", "clusterAdmin", "dbAdminAnyDatabase"]}) + +# list all dbs users +db.system.users.find() + # Create user, don't forget to use the correct database use <db_name> db.createUser({user:"root", pwd:"root", roles: ["readWrite"]}) # Create use in another database: +use madbtest db.createUser({user:"admin", pwd:"vIhVPwy81sdf5fPt3a2", roles: [{role: "readWrite" , db: "madbtest"}]}) +# udpate pwd +db.updateUser("username", {pwd: ""}) + # mongoshell get schema collection # Source: https://medium.com/@ahsan.ayaz/how-to-find-schema-of-a-collection-in-mongodb-d9a91839d992 |