aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/cheat/mongodb
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2020-10-04 22:25:33 +0200
committerneodarz <neodarz@neodarz.net>2020-10-04 22:25:33 +0200
commit9443eb4006a06bc3d9a2ac3d5339ac394d2c5c6e (patch)
tree864670655f9bd3d521410dd24fa14b002ab3c81c /dotfiles/cheat/mongodb
parent8b4e51ffa979c10e37d7ba3d7957184b751c2db7 (diff)
downloaddotfiles_dotdrop-9443eb4006a06bc3d9a2ac3d5339ac394d2c5c6e.tar.xz
dotfiles_dotdrop-9443eb4006a06bc3d9a2ac3d5339ac394d2c5c6e.zip
Update some cheat
Diffstat (limited to 'dotfiles/cheat/mongodb')
-rw-r--r--dotfiles/cheat/mongodb11
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