Share via


az cosmosdb mongodb collection

Note

This reference is part of the cosmosdb-preview extension for the Azure CLI (version 2.17.1 or higher). The extension will automatically install the first time you run an az cosmosdb mongodb collection command. Learn more about extensions.

Manage Azure Cosmos DB MongoDB collections.

Commands

Name Description Type Status
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.

Extension Preview
az cosmosdb mongodb collection retrieve-partition-throughput

Retrieve the partition throughput of a mongodb collection.

Extension Preview

az cosmosdb mongodb collection merge

Preview

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

--account-name -a

Name of the CosmosDB database account.

--database-name -d

Name of the mongoDB database.

--name -n

Name of the mongoDB collection.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az cosmosdb mongodb collection redistribute-partition-throughput

Preview

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

--account-name -a

Name of the CosmosDB database account.

--database-name -d

Name of the CosmosDB database name.

--name -n

Name of the CosmosDB collection.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--evenly-distribute

Switch to distribute throughput equally among all physical partitions.

Accepted values: false, true
Default value: False
--source-partition-info

Space separated source physical partition ids eg: 1 2.

Default value: []
--target-partition-info

Information about desired target physical partition throughput eg: '0=1200 1=1200'.

Default value: []
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az cosmosdb mongodb collection restore

Preview

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

--account-name -a

Cosmosdb account name.

--database-name -d

Database name.

--name -n

Collection name.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--disable-ttl
Preview

Enable or disable restoring with ttl disabled.

Accepted values: false, true
--restore-timestamp -t

The timestamp to which the collection needs to be restored to.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az cosmosdb mongodb collection retrieve-partition-throughput

Preview

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

--account-name -a

Name of the CosmosDB database account.

--database-name -d

Name of the CosmosDB database name.

--name -n

Name of the CosmosDB container.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--all-partitions

Switch to retrieve throughput for all physical partitions.

Accepted values: false, true
Default value: False
--physical-partition-ids -p

Space separated list of physical partition ids.

Default value: []
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.