getRoles({ rolesInfo?, showPrivileges?, showBuiltinRoles? }?)
This method returns information for all the roles in the database on which the command runs.
Syntax:
db.getRoles({ rolesInfo?, showPrivileges?, showBuiltinRoles? }?)
Example
db.getRoles({
rolesInfo: 1,
showBuiltinRoles:true
})
MongoDB
db.getRoles({rolesInfo: 1,showBuiltinRoles:true})
Output:
[{"role" : "readWrite","db" : "test","isBuiltin" : true,"roles" : [ ],"inheritedRoles" : [ ]},{"role" : "read","db" : "test","isBuiltin" : true,"roles" : [ ],"inheritedRoles" : [ ]},{"role" : "dbAdmin","db" : "test","isBuiltin" : true,"roles" : [ ],"inheritedRoles" : [ ]},{"role" : "userAdmin","db" : "test","isBuiltin" : true,"roles" : [ ],"inheritedRoles" : [ ]},{"role" : "dbOwner","db" : "test","isBuiltin" : true,"roles" : [ ],"inheritedRoles" : [ ]},{"role" : "enableSharding","db" : "test","isBuiltin" : true,"roles" : [ ],"inheritedRoles" : [ ]}]
No comments:
Post a Comment