az cosmosdb mongodb collection

Manage Azure Cosmos DB MongoDB collections.

Commands

az cosmosdb mongodb collection create

Create an MongoDB collection under an Azure Cosmos DB MongoDB database.

az cosmosdb mongodb collection delete

Delete the MongoDB collection under an Azure Cosmos DB MongoDB database.

az cosmosdb mongodb collection exists

Checks if an Azure Cosmos DB MongoDB collection exists.

az cosmosdb mongodb collection list

List the MongoDB collections under an Azure Cosmos DB MongoDB database.

az cosmosdb mongodb collection show

Show the details of a MongoDB collection under an Azure Cosmos DB MongoDB database.

az cosmosdb mongodb collection throughput

Manage throughput of MongoDB collection under an Azure Cosmos DB account.

az cosmosdb mongodb collection throughput migrate

Migrate the throughput of the MongoDB collection between autoscale and manually provisioned.

az cosmosdb mongodb collection throughput show

Get the throughput of the MongoDB collection under an Azure Cosmos DB MongoDB database.

az cosmosdb mongodb collection throughput update

Update the throughput of the MongoDB collection under an Azure Cosmos DB MongoDB database.

az cosmosdb mongodb collection update

Update an MongoDB collection under an Azure Cosmos DB MongoDB database.

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]
                                      [--subscription]
                                      [--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

--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

--analytical-storage-ttl

Analytical TTL, when analytical storage is enabled.

--idx

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"}}]".

--max-throughput

The maximum throughput resource can scale to (RU/s). Provided when the resource is autoscale enabled. The minimum value can be 4000 (RU/s).

--shard

Sharding key path.

--subscription

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

--throughput

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.

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
                                      [--subscription]
                                      [--yes]

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

--subscription

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

--yes -y

Do not prompt for confirmation.

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
                                      [--subscription]

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

--subscription

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

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
                                    [--query-examples]
                                    [--subscription]

Required Parameters

--account-name -a

Cosmosdb account name.

--database-name -d

Database name.

--resource-group -g

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

Optional Parameters

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--subscription

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

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
                                    [--query-examples]
                                    [--subscription]

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

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--subscription

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

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]
                                      [--subscription]

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

--analytical-storage-ttl

Analytical TTL, when analytical storage is enabled.

--idx

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"}}]".

--subscription

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