turbot/mongodbatlas
steampipe plugin install mongodbatlas

Table: mongodbatlas_custom_db_role - Query MongoDB Atlas Custom Database Roles using SQL

MongoDB Atlas Custom Database Roles represent a collection of permissions that you can assign to users. These roles can be used to grant specific privileges to the users on a specific database. The privileges determine the operations that the users can perform on the database.

Table Usage Guide

The mongodbatlas_custom_db_role table provides insights into custom database roles within MongoDB Atlas. As a database administrator, explore specific details about these roles, including database name, role name, and associated actions. Utilize it to manage and control access to your databases, ensuring that users have the appropriate permissions for their roles.

Examples

Basic info

Explore which custom database roles have been assigned in your MongoDB Atlas and identify the associated actions. This can help in understanding user permissions and improve the security management of your database.

select
role_name,
actions
from
mongodbatlas_custom_db_role;
select
role_name,
actions
from
mongodbatlas_custom_db_role;

List roles which have the 'FIND' action defined

Explore which roles have the 'FIND' action defined to understand the distribution of permissions within your database, which can help in maintaining security and access controls.

select
role_name
from
mongodbatlas_custom_db_role as r,
jsonb_array_elements(t.actions) as a
where
a ->> 'action' = 'FIND';
select
role_name
from
mongodbatlas_custom_db_role as r,
json_each(r.actions) as a
where
json_extract(a.value, '$.action') = 'FIND';

List roles which have at least one inherited role

Discover which roles in your MongoDB Atlas database have inherited roles, allowing you to better understand role hierarchies and permissions in your database system. This can be particularly useful in larger systems where role management may become complex.

select
role_name
from
mongodbatlas_custom_db_role
where
jsonb_array_length(inherited_roles) > 0;
select
role_name
from
mongodbatlas_custom_db_role
where
json_array_length(inherited_roles) > 0;

Schema for mongodbatlas_custom_db_role

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
actionsjsonbEach object in the actions array represents an individual privilege action granted by the role.
inherited_rolesjsonbEach object in the inherited_roles array represents a key-value pair indicating the inherited role and the database on which the role is granted.
organization_idtext=, !=, ~~, ~~*, !~~, !~~*Unique identifier for the organization.
project_idtext=The unique identifier of the project for this role.
role_nametext=The name of the role.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
titletextTitle of the resource.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- mongodbatlas

You can pass the configuration to the command with the --config argument:

steampipe_export_mongodbatlas --config '<your_config>' mongodbatlas_custom_db_role