db.dropRole() in mongodb

dropRole(rolename, writeConcern?)

This method deletes a user-defined role from the database on which you run the method.


The following operations remove the "roleName" role from the products database:

use products

db.dropRole( "roleName", { w: "majority" } )


Approach 1: When the role is present.

MongoDB


db.dropRole( "roleName", { w: "majority" } )

Output:

true


Example 2: When role is not present

MongoDB


db.dropRole( "roleName", { w: "majority" } )

Output:

false

No comments:

Post a Comment