Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create a sharded MongoDB in CosmosDB using the Azure CLI
#!/bin/bash
resourceGroupName="cosmosdbshardedtest"
name="mongodboncosmosdb"
databaseName="mongodb"
collectionName="mongodbcoll"
kind="MongoDB"
partition="/'\$v'/YourShardID/'\$v'"
az login
az group create --name $resourceGroupName --location westeurope
az cosmosdb create --name $name --kind $kind --resource-group $resourceGroupName
az cosmosdb database create --name $name --db-name $databaseName --resource-group $resourceGroupName
az cosmosdb collection create --collection-name $collectionName --name $name --db-name $databaseName --resource-group $resourceGroupName --partition-key-path $partition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.