MongoDB Enterprise>db.createRole ( { role: 'HRDEPARTMENT',
privileges: [ { resource: { db: 'HR', collection: '' } , actions: [ "find" ] } , {resource: {db: 'HR', collection: 'employees' }, actions: ["insert"] } ],
roles: [ { role: 'dropUser', db: 'HR'}
]
} )
Error: Cannot grant nonexistent role dropUser@HR :
Error: Cannot grant nonexistent role dropUser@HR :
Hi Raj,
As specified on the manual for createRole(), the roles field should contain a role to inherit privileges from. According to the error log that you are seeing, there is no role with name dropUser.
If you are attempting to inherit from the built-in roles , dropUser is a privilege action not a role.
MongoDB Enterprise>db.createRole
Note that the MongoDB Enterprise edition is a commercially supported product. If your company already has a commercial subscription I would suggest to open a case in the Commercial Support Portal.
Alternatively if you are evaluating MongoDB Enterprise and interested, send me a private message with your contact details and I can request a MongoDB Account Executive to reach out to you.
Kind regards,
Wan.