liveBook · Manning

Atlas customDbRoles create

As explained in MongoDB 8.0 in Action, Third Edition

atlas customDbRoles create is an Atlas CLI command that creates a custom database role with specified privileges.

atlas customDbRoles create creates a custom database role from explicit privilege actions and optional inherited roles. Roles created outside admin remain limited to their own database and same-database inherited roles, supporting least-privilege access. section 20.3.3

Define a role by specifying:

  • Privilege actions such as FIND, INSERT, or UPDATE. section 20.3.3
  • Databases or collections where each privilege applies. section 20.3.3
  • Optional inherited default or custom roles, avoiding redundant permission definitions. section 20.3.3
atlas customDbRoles create customReadUpdateRole \
--privilege 'UPDATE@sample_training.routes' \
--privilege 'FIND@sample_supplies.sales'

Creates customReadUpdateRole with UPDATE access to sample_training.routes and FIND access to sample_supplies.sales. section 20.3.3

atlas customDbRoles create readWriteAnalyticsRole \
--privilege 'INSERT@sample_analytics' \
--inheritedRole 'read@sample_analytics'

Creates readWriteAnalyticsRole with INSERT access on sample_analytics while inheriting the existing read role there. section 20.3.3

How MongoDB 8.0 in Action, Third Edition covers it

How deep it goes
Defines privilege resources, actions, database scope, collections, and inheritance through copyable CLI commands.
Examples
Uses customReadUpdateRole and readWriteAnalyticsRole to demonstrate collection privileges and inherited read access.
What you can do after
Operate/configure Atlas custom roles with explicit database, collection, action, and inherited-role permissions.
How it connects
Connects custom roles with privileges, inherited roles, database scope, RBAC, and least privilege.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of MongoDB 8.0 in Action, Third Edition. The section links point to the parts of the book it draws on.