From 9443eb4006a06bc3d9a2ac3d5339ac394d2c5c6e Mon Sep 17 00:00:00 2001 From: neodarz Date: Sun, 4 Oct 2020 22:25:33 +0200 Subject: Update some cheat --- dotfiles/cheat/mongodb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'dotfiles/cheat/mongodb') 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.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 -- cgit v1.2.1