Azure Cosmos DB container sorting of records

Chris Buley 156 Reputation points
2024-02-20T21:55:08.5966667+00:00

Hi everyone,

We have an Azure Cosmos DB container that gets populated with batched entries and currently they get sorted by the "c_ts" JSON value. I would like them to be sorted by "creationDate" value in Oldest to Newest order.

Is there a way I can do that, maybe with the Indexing Policy for that container? Kind regards Chris.

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,901 questions
{count} votes

Accepted answer
  1. Oury Ba-MSFT 20,911 Reputation points Microsoft Employee Moderator
    2024-02-21T18:26:33.3233333+00:00

    Chris Buley Thank you for clarifying this. Yes, the indexing policy you’ve provided aims to sort the entries in your Azure Cosmos DB container by the “creationDate” value in Oldest to Newest order. { "automatic":true, "indexingMode":"Consistent", "includedPaths":[ { "path":"/*" } ], "excludedPaths":[], "compositeIndexes":[ [ { "path":"/creationDate", "order":"ascending" } ] } Manage indexing policies in Azure Cosmos DB Regards, Oury


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.