0

I am using @azure/cosmos with version 3.9.5 for creating Container and collection in Cosmos DB. I am trying to create collection with maxThroughput parameter so that auto scaling will be enabled.

comosRefClient.database("sample").containers.createIfNotExists({ id: "samplecoll1", 5000 });

As per documentation, this should create collection with Autoscaling with Max RU of 5000. But collection is created with Manual Mode and 5000 RUs.

I checked in the documentation as well as unit testing code from SDK and ideally things should work fine.

  1. API - https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/cosmosdb/cosmos/src/client/Container/ContainerRequest.ts
  2. Documentation - https://learn.microsoft.com/en-us/javascript/api/@azure/cosmos/containerrequest?view=azure-node-latest
  3. Unit Testing from SDK - https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/cosmosdb/cosmos/test/public/functional/container.spec.ts

Appreciate your help on this question.

S Madhanmohan
  • 45
  • 1
  • 14
  • deployment didn't install the latest library due to unique issue in CI/CD pipeline. After fixing the issue, required version of @azure/cosmos was installed and able to create collection with autoscale – S Madhanmohan Mar 19 '21 at 09:36

1 Answers1

0

I use the same version with yours. I tried this code and it can work:

const { resource: containerDef } = await client.database("sample").containers.createIfNotExists({ id: "samplecoll1",maxThroughput:5000});

enter image description here

Steve Johnson
  • 8,057
  • 1
  • 6
  • 17