db.dropAllRoles() in mongodb

dropAllRoles(writeConcern?)

This method deletes all user-defined roles on the database where you run the method.


The following operations drop all user-defined roles from the products database and use a write concern of the majority.


use admin

db.dropAllRoles( { w: "majority" } )


Approach 1: DB contains some roles

MongoDB

db.dropAllRoles( { w: "majority" } )

Output:

2


Example 2: If there is no role.

MongoDB

db.dropAllRoles( { w: "majority" } )

Output:

0

No comments:

Post a Comment