Share via

How can I define a collation, when creating an index in Cosmos DB?

Munkel, Georg 5 Reputation points
2023-06-13T08:48:47.5333333+00:00

Hi - I'm trying to migrate from a self-hosted mongodb instance to cosmos db.

I managed to move all collections (after raising the limits several times).

Now my work is to build all missing indices. Unfortunately I can't find a way to set the collation on an index. My target is to be able to sort on german text. So I attempt to define an index in mongosh like:

db.Users.createIndex({lastName:1},{collation:{locale: "de"}})

but I receive:

MongoServerError: collation
Azure Cosmos DB
Azure Cosmos DB

An Azure NoSQL database service for app development.

{count} vote

2 answers

Sort by: Most helpful
  1. SSingh-MSFT 16,461 Reputation points Moderator
    2023-06-14T09:39:07.24+00:00

    Hi Munkel, Georg •,

    As mentioned by the Internal team, Collation is not supported currently with Cosmos DB for MongoDB with both RU and vCore based.

    However, I would recommend you to share your valuable feedback for this feature enablement over Azure Cosmos Database Feedback Channel where concerned team will look into the requests and prioritize on the basis of importance and up-votes.

    Thank you.


  2. Sajeetharan 2,261 Reputation points Microsoft Employee
    2023-06-13T10:48:52.68+00:00

    Collation is not supported currently with Cosmos DB for MongoDB with both RU and vCore based.


Your answer

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