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 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 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
--shard
[--idx]
[--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>.

--shard

Sharding key path.

Optional Parameters

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

--throughput

The throughput of MongoDB collection (RU/s). Default value is 400.

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]

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

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

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

az cosmosdb mongodb collection update --account-name
--database-name
--name
--resource-group
[--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

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