Use grantRolesToUser function to grant read & write roles. See also clusterManager and clusterMonitor role for access to the config and local databases. Look at the field name called user and found the value as we would need this in the next step. Please see the example below of a custom role with the find action allowed for the testdb database: Note. To provide dbAdmin privileges on the local database, create a user in the admin database with dbAdmin role in the local database. Which permission should I assign to this user to be able to run aggregate You can assign the find action so that database users associated with a custom role with this action are allowed to perform the aggregation command you have provided. A user with dbadmin or useradmin can admin the database. With the following command, you can grant read & write access to all the databases except local & config > use admin > db. The role also provides the listDatabases action on the cluster as a whole.Ĭhanged in version 3.4: Prior to 3.4, dbAdminAnyDatabase includes local and config databases. Its a bit confusing - I believe you will need to grant yourself readWrite to query a database. Provides the same privileges as dbAdmin on all databases except local and config. A given role applies to the database on which it is defined and can grant access down to a collection level of granularity. You can additionally create User-defined roles.Ī role grants privileges to perform sets of actions on defined resources. what roles the user to grantĭb.createUser() Īs per MongoDB documentation here MongoDB grants access to data and commands through role-based authorization and provides built-in roles that provide the different levels of access commonly needed in a database system. This role combines the privileges granted by the readWrite, dbAdmin and userAdmin. I want to giveĪccess for new databases for this user. Grant read and write without dropCollection in MongoDB Atlas. The database owner can perform any administrative action on the database. I have created mongouser as testuser with below roles.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |