Last active
May 16, 2018 14:38
-
-
Save sarjarapu/89888cc5c2a5830669e16f2548fb6501 to your computer and use it in GitHub Desktop.
Set of bash & JavaScript to show that user with readWrite role can drop a collection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mongo social --port 28000 -u app_user -p password --authenticationDatabase admin | |
# output of above command | |
# MongoDB shell version v3.6.2 | |
# connecting to: mongodb://127.0.0.1:28000/social | |
# MongoDB server version: 3.6.2 | |
# replset:PRIMARY> | |
# create a document in person collection | |
db.person.insert({"fname": "Shyam", "lname": "Arjarapu"}) | |
# output of above command | |
# WriteResult({ "nInserted" : 1 }) | |
db.getCollectionNames() | |
# The output of above command | |
# [ "person" ] | |
# drop the collection | |
db.person.drop() | |
# The output of above command | |
# true | |
db.getCollectionNames() | |
# The output of above command | |
# [ ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment