Last active
September 6, 2018 06:59
-
-
Save mattn9x/c726042153582f28784fb2110d2829f1 to your computer and use it in GitHub Desktop.
Custom role with role promaster
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
| use admin | |
| var role = { | |
| 'role' : 'promaster', | |
| 'privileges' : [ | |
| { | |
| 'resource': {'db' : 'company', 'collection' : 'users'}, | |
| 'actions': ['find'] | |
| }, | |
| { | |
| 'resource': {'db' : 'demo', 'collection' : 'chat'}, | |
| 'actions': ['update'] | |
| } | |
| ], | |
| 'roles' : [ | |
| {'role': 'readWrite', 'db': 'phone_solution'}, | |
| {'role': 'read', 'db': 'demo'} | |
| ] | |
| } | |
| db.createRole( role ); | |
| var user = { | |
| 'user' : 'admin3', | |
| 'pwd' : 'admin123abc3', | |
| 'roles' : [ | |
| {'role' : 'promaster', 'db' : 'admin'} | |
| ] | |
| } | |
| db.createUser(user); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment