javascriptapicollectionsazure-cosmosdbautoscalemode

Cosmos Javascript API for creating collection with Autoscale


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.


Solution

  • 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