az cosmosdb mongodb collection
Note
This command group has commands that are defined in both Azure CLI and at least one extension. Install each extension to benefit from its extended capabilities. Learn more about extensions.
Manage Azure Cosmos DB MongoDB collections.
Commands
Name | Description | Type | Status |
---|---|---|---|
az cosmosdb mongodb collection create |
Create an MongoDB collection under an Azure Cosmos DB MongoDB database. |
Core | GA |
az cosmosdb mongodb collection delete |
Delete the MongoDB collection under an Azure Cosmos DB MongoDB database. |
Core | GA |
az cosmosdb mongodb collection exists |
Checks if an Azure Cosmos DB MongoDB collection exists. |
Core | GA |
az cosmosdb mongodb collection list |
List the MongoDB collections under an Azure Cosmos DB MongoDB database. |
Core | GA |
az cosmosdb mongodb collection merge |
Merges the partitions of a mongodb collection. |
Extension | Preview |
az cosmosdb mongodb collection redistribute-partition-throughput |
Redistributes the partition throughput of a mongodb collection. |
Extension | Preview |
az cosmosdb mongodb collection restore |
Restore a deleted mongodb collection within the same account. |
Core | GA |
az cosmosdb mongodb collection restore (cosmosdb-preview extension) |
Restore a deleted mongodb collection within the same account. |
Extension | Preview |
az cosmosdb mongodb collection retrieve-partition-throughput |
Retrieve the partition throughput of a mongodb collection. |
Extension | Preview |
az cosmosdb mongodb collection show |
Show the details of a MongoDB collection under an Azure Cosmos DB MongoDB database. |
Core | GA |
az cosmosdb mongodb collection throughput |
Manage throughput of MongoDB collection under an Azure Cosmos DB account. |
Core | GA |
az cosmosdb mongodb collection throughput migrate |
Migrate the throughput of the MongoDB collection between autoscale and manually provisioned. |
Core | GA |
az cosmosdb mongodb collection throughput show |
Get the throughput of the MongoDB collection under an Azure Cosmos DB MongoDB database. |
Core | GA |
az cosmosdb mongodb collection throughput update |
Update the throughput of the MongoDB collection under an Azure Cosmos DB MongoDB database. |
Core | GA |
az cosmosdb mongodb collection update |
Update an MongoDB collection under an Azure Cosmos DB MongoDB database. |
Core | GA |
az cosmosdb mongodb collection create
Create an MongoDB collection under an Azure Cosmos DB MongoDB database.
az cosmosdb mongodb collection create --account-name
--database-name
--name
--resource-group
[--analytical-storage-ttl]
[--idx]
[--max-throughput]
[--shard]
[--throughput]
Examples
Create an Azure Cosmos DB MongoDB collection.
az cosmosdb mongodb collection create -g MyResourceGroup -a MyAccount -d MyDatabase -n MyCollection --shard "ShardingKey" --idx @indexes-file.json --throughput "500"
Required Parameters
Cosmosdb account name.
Database name.
Collection name.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Analytical TTL, when analytical storage is enabled.
Indexes, you can enter it as a string or as a file, e.g., --idx @indexes-file.json or --idx "[{"key": {"keys": ["_ts"]},"options": {"expireAfterSeconds": 1000}}, {"key": {"keys": ["user_id", "user_address"]}, "options": {"unique": "true"}}]".
The maximum throughput resource can scale to (RU/s). Provided when the resource is autoscale enabled. The minimum value can be 4000 (RU/s).
Sharding key path.
The throughput of MongoDB collection (RU/s). Default value is 400. Omit this parameter if the database has shared throughput unless the collection should have dedicated throughput.
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az cosmosdb mongodb collection delete
Delete the MongoDB collection under an Azure Cosmos DB MongoDB database.
az cosmosdb mongodb collection delete --account-name
--database-name
--name
--resource-group
[--yes]
Required Parameters
Cosmosdb account name.
Database name.
Collection name.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Do not prompt for confirmation.
Property | Value |
---|---|
Default value: | False |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az cosmosdb mongodb collection exists
Checks if an Azure Cosmos DB MongoDB collection exists.
az cosmosdb mongodb collection exists --account-name
--database-name
--name
--resource-group
Required Parameters
Cosmosdb account name.
Database name.
Collection name.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az cosmosdb mongodb collection list
List the MongoDB collections under an Azure Cosmos DB MongoDB database.
az cosmosdb mongodb collection list --account-name
--database-name
--resource-group
Required Parameters
Cosmosdb account name.
Database name.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az cosmosdb mongodb collection merge
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
Merges the partitions of a mongodb collection.
az cosmosdb mongodb collection merge --account-name
--database-name
--name
--resource-group
Examples
merge partitions of collection my-mongodb-collection
az cosmosdb mongodb collection merge -g my-resource-group -a my-account -d my-db --name my-mongodb-collection
Required Parameters
Name of the CosmosDB database account.
Name of the mongoDB database.
Name of the mongoDB collection.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az cosmosdb mongodb collection redistribute-partition-throughput
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
Redistributes the partition throughput of a mongodb collection.
az cosmosdb mongodb collection redistribute-partition-throughput --account-name
--database-name
--name
--resource-group
[--evenly-distribute {false, true}]
[--source-partition-info]
[--target-partition-info]
Examples
Evenly distributes the partition throughput for a mongodb collection among all physical partitions
az cosmosdb mongodb collection redistribute-partition-throughput --account-name account_name --database-name db_name --name container_name --resource-group rg_name --evenly-distribute
Redistributes the partition throughput for a mongodb collection from source partitions to target partitions
az cosmosdb mongodb collection redistribute-partition-throughput --account-name account_name --database-name db_name --name container_name --resource-group rg_name --target-partition-info 8=1200 6=1200' --source-partition-info 9'
Required Parameters
Name of the CosmosDB database account.
Name of the CosmosDB database name.
Name of the CosmosDB collection.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Switch to distribute throughput equally among all physical partitions.
Property | Value |
---|---|
Default value: | False |
Accepted values: | false, true |
Space separated source physical partition ids eg: 1 2.
Property | Value |
---|---|
Default value: | [] |
Information about desired target physical partition throughput eg: '0=1200 1=1200'.
Property | Value |
---|---|
Default value: | [] |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az cosmosdb mongodb collection restore
Restore a deleted mongodb collection within the same account.
az cosmosdb mongodb collection restore --account-name
--database-name
--name
--resource-group
[--disable-ttl]
[--restore-timestamp]
Examples
Restore a deleted mongodb collection within the same account.
az cosmosdb mongodb collection restore --resource-group resource_group --account-name database_account_name --database-name parent_database_name --name name_of_collection_needs_to_be_restored --restore-timestamp 2020-07-13T16:03:41+0000
Required Parameters
Cosmosdb account name.
Database name.
Collection name.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Flag to restore with TTL disabled.
Usage: --disable-ttl True Default: false.
The timestamp to which the collection needs to be restored to.
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az cosmosdb mongodb collection restore (cosmosdb-preview extension)
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
Restore a deleted mongodb collection within the same account.
az cosmosdb mongodb collection restore --account-name
--database-name
--name
--resource-group
[--disable-ttl {false, true}]
[--restore-timestamp]
Examples
Restore a deleted mongodb collection within the same account.
az cosmosdb mongodb collection restore --resource-group resource_group --account-name database_account_name --database-name parent_database_name --name name_of_collection_needs_to_be_restored --restore-timestamp 2020-07-13T16:03:41+0000
Required Parameters
Cosmosdb account name.
Database name.
Collection name.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Enable or disable restoring with ttl disabled.
Property | Value |
---|---|
Accepted values: | false, true |
The timestamp to which the collection needs to be restored to.
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az cosmosdb mongodb collection retrieve-partition-throughput
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
Retrieve the partition throughput of a mongodb collection.
az cosmosdb mongodb collection retrieve-partition-throughput --account-name
--database-name
--name
--resource-group
[--all-partitions {false, true}]
[--physical-partition-ids]
Examples
Retrieve container container_name's throughput for specific physical partitions
az cosmosdb mongodb collection retrieve-partition-throughput --account-name account_name --database-name db_name --name container_name --resource-group rg_name --physical-partition-ids 8 9
Retrieve container container_name's throughput for all physical partitions
az cosmosdb mongodb collection retrieve-partition-throughput --account-name account_name --database-name db_name --name container_name --resource-group rg_name --all-partitions
Required Parameters
Name of the CosmosDB database account.
Name of the CosmosDB database name.
Name of the CosmosDB container.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Switch to retrieve throughput for all physical partitions.
Property | Value |
---|---|
Default value: | False |
Accepted values: | false, true |
Space separated list of physical partition ids.
Property | Value |
---|---|
Default value: | [] |
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az cosmosdb mongodb collection show
Show the details of a MongoDB collection under an Azure Cosmos DB MongoDB database.
az cosmosdb mongodb collection show --account-name
--database-name
--name
--resource-group
Required Parameters
Cosmosdb account name.
Database name.
Collection name.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |
az cosmosdb mongodb collection update
Update an MongoDB collection under an Azure Cosmos DB MongoDB database.
az cosmosdb mongodb collection update --account-name
--database-name
--name
--resource-group
[--analytical-storage-ttl]
[--idx]
Required Parameters
Cosmosdb account name.
Database name.
Collection name.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Optional Parameters
The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.
Analytical TTL, when analytical storage is enabled.
Indexes, you can enter it as a string or as a file, e.g., --idx @indexes-file.json or --idx "[{"key": {"keys": ["_ts"]},"options": {"expireAfterSeconds": 1000}}, {"key": {"keys": ["user_id", "user_address"]}, "options": {"unique": "true"}}]".
Global Parameters
Increase logging verbosity to show all debug logs.
Property | Value |
---|---|
Default value: | False |
Show this help message and exit.
Only show errors, suppressing warnings.
Property | Value |
---|---|
Default value: | False |
Output format.
Property | Value |
---|---|
Default value: | json |
Accepted values: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity. Use --debug for full debug logs.
Property | Value |
---|---|
Default value: | False |