Last active
July 8, 2017 19:19
-
-
Save mattn9x/b8f9e92f525747c87ced3ad7e9e83480 to your computer and use it in GitHub Desktop.
Custom user role in mongodb
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' : 'develop', | |
'privileges' : [ | |
{ | |
'resource': {'db' : 'company', 'collection' : 'users'}, | |
'actions': ['find'] | |
} | |
], | |
'roles' : [ | |
{'role' : 'readWrite', 'db' : 'phone_solution'} | |
] | |
} | |
db.createRole( role ); | |
var user = { | |
'user' : 'admin2', | |
'pwd' : 'admin123abc', | |
roles : [ | |
{'role' : 'develop', 'db' : 'admin'} | |
] | |
} | |
db.createUser(user); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment