2

Currently I have a shell script that has to Create a Cosmos DB account for MongoDB API in an existing resource group in an Azure project.

Bellow is the code snippet that does precisely that

az cosmosdb create \
    -n $accountName \
    -g $resourceGroupName \
    --kind MongoDB \
    --default-consistency-level Eventual \
    --locations regionName='West Europe' failoverPriority=0 isZoneRedundant=False \
    --locations regionName='East US' failoverPriority=1 isZoneRedundant=False

However this generates a Server Version 3.2 by default.

generates a Server Version 3.2 by default

My goal is to replicate in an "az" command the following behavior from the UI where I manually generate a Version 3.6, resulting in successful reading of version 3.6

Do you know what I should change within that code snippet to have it creating directly a wire protocol 3.6 CosmosDB account?

Thanks! Mihai

Stennie
  • 63,885
  • 14
  • 149
  • 175
msarlea
  • 23
  • 4

1 Answers1

2

Just add --capabilities EnableMongo and it will create an account targeting MongoDB version 3.6.

So your command would be:

az cosmosdb create \
    -n $accountName \
    -g $resourceGroupName \
    --kind MongoDB \
    --default-consistency-level Eventual \
    --locations regionName='West Europe' failoverPriority=0 isZoneRedundant=False \
    --locations regionName='East US' failoverPriority=1 isZoneRedundant=False \
    --capabilities name=EnableMongo

enter image description here

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
  • Looks like this worked for me in the ```--capabilities EnableMongo``` format. Thank you so much! – msarlea Feb 27 '20 at 11:44