Table: azure_cosmosdb_mongo_database - Query Azure Cosmos DB MongoDB Databases using SQL
Azure Cosmos DB is a globally distributed, multi-model database service for managing data at planet-scale. It's built to power today's IoT and mobile apps, and tomorrow's AI-hungry future. The MongoDB API allows you to use Azure Cosmos DB as a fully managed NoSQL database to build modern and scalable applications.
Table Usage Guide
The azure_cosmosdb_mongo_database
table provides detailed information about each MongoDB database within an Azure Cosmos DB account. As a database administrator or developer, you can use this table to gain insights into your MongoDB databases, including their properties, configuration settings, and associated metadata. This table is particularly useful for auditing, managing, and optimizing your Azure Cosmos DB MongoDB databases.
Examples
Basic info
Explore the performance and location details of your Azure Cosmos DB Mongo databases. This query can help you understand the maximum throughput settings and actual throughput, which can be useful for optimizing your database's performance and managing resources effectively.
select name, autoscale_settings_max_throughput, throughput, account_name, region, resource_groupfrom azure_cosmosdb_mongo_database;
select name, autoscale_settings_max_throughput, throughput, account_name, region, resource_groupfrom azure_cosmosdb_mongo_database;
Database count by cosmosdb account name
Determine the number of databases linked to each CosmosDB account in Azure. This is useful for understanding the distribution and organization of databases across different accounts in your Azure environment.
select account_name, count(name) as database_countfrom azure_cosmosdb_mongo_databasegroup by account_name;
select account_name, count(name) as database_countfrom azure_cosmosdb_mongo_databasegroup by account_name;
Get throughput settings for each database
Determine the areas in which throughput settings for each database in your Azure CosmosDB MongoDB can be optimized. This query can help in understanding the current configuration and identifying potential areas for performance improvement.
select name, account_name, throughput_settings ->> 'Name' as name, throughput_settings ->> 'ResourceThroughput' as throughput, throughput_settings ->> 'AutoscaleSettingsMaxThroughput' as maximum_throughput, throughput_settings ->> 'ResourceMinimumThroughput' as minimum_throughput, throughput_settings ->> 'ID' as idfrom azure_cosmosdb_mongo_database;
select name, account_name, json_extract(throughput_settings, '$.Name') as name, json_extract(throughput_settings, '$.ResourceThroughput') as throughput, json_extract( throughput_settings, '$.AutoscaleSettingsMaxThroughput' ) as maximum_throughput, json_extract( throughput_settings, '$.ResourceMinimumThroughput' ) as minimum_throughput, json_extract(throughput_settings, '$.ID') as idfrom azure_cosmosdb_mongo_database;
Query examples
- cosmosdb_account_database_count
- cosmosdb_account_database_details
- cosmosdb_mongo_collection_for_cosmosdb_mongo_database
- cosmosdb_mongo_database_collection_count
- cosmosdb_mongo_database_collection_details
- cosmosdb_mongo_database_for_cosmosdb_account
- cosmosdb_mongo_database_tags
- cosmosdb_mongo_database_throughput_settings
Schema for azure_cosmosdb_mongo_database
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_name | text | = | The friendly name that identifies the database account in which the database is created. |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
autoscale_settings_max_throughput | bigint | Contains maximum throughput, the resource can scale up to. | |
cloud_environment | text | The Azure Cloud Environment. | |
database_etag | text | A system generated property representing the resource etag required for optimistic concurrency control. | |
database_id | text | Name of the Cosmos DB MongoDB database. | |
database_rid | text | A system generated unique identifier for database. | |
database_ts | bigint | A system generated property that denotes the last updated timestamp of the resource. | |
id | text | Contains ID to identify a Mongo DB database uniquely. | |
name | text | = | The friendly name that identifies the Mongo DB database. |
region | text | The Azure region/location in which the resource is located. | |
resource_group | text | = | The resource group which holds this resource. |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
subscription_id | text | =, !=, ~~, ~~*, !~~, !~~* | The Azure Subscription ID in which the resource is located. |
tags | jsonb | A map of tags for the resource. | |
throughput | bigint | Contains the value of the Cosmos DB resource throughput or autoscaleSettings. | |
throughput_settings | jsonb | Contains the value of the Cosmos DB resource throughput or autoscaleSettings. | |
title | text | Title of the resource. | |
type | text | Type 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)" -- azure
You can pass the configuration to the command with the --config
argument:
steampipe_export_azure --config '<your_config>' azure_cosmosdb_mongo_database