Hi Saha,
Hi Deepjyoti,
There is no built-in role for dbOwner that applies to all databases.
The dbOwner role combines the privileges granted by the readWrite, dbAdmin and userAdmin roles. If the userAdmin role is granted to all databases (including the admin database) this indirectly provides superuser access to any databases and the cluster.
If there are no built-in roles that are suitable for your requirements, there is a way to create new custom roles. See Create a User-Defined Role for more details.
For example, to create a new role called customRoleAnyDatabase which combines the role of readWrite and dbAdmin on database foo and bar:
use admin
db.runCommand({
createRole: "customRoleAnyDatabase",
privileges: [],
roles: [
{ role: "readWrite", db: "foo" },
{ role: "readWrite", db: "bar" },
{ role: "dbAdmin", db: "foo"},
{ role: "dbAdmin", db: "bar"}
],
writeConcern: { w: "majority" , wtimeout: 5000 }
})
In addition to roles, you can also specify privileges for granularity.
A role created in the admin database can include privileges that apply to the admin database, other databases or to the cluster resource, and can inherit from roles in other databases as well as the admin database.
For more information and examples please see Manage users and roles.
Kind Regards,
Wan.