Mongorestore is not working with Cosmos

Mongorestore is erroring out after successful mongodump from my source db which is 4.2.1. Target is azure cosmos mongo API which is at 4.0

Getting the error in the first collection itself -
Failed: : error creating collection: error running create command: (FailedToParse) Unrecognized field: idIndex.‘collation’.

Any leads?

:wave: Welcome to the MongoDB Community @Ranilakshmi_Rangaraj!

Azure Cosmos DB is a Microsoft cloud database product with partial emulation for popular database APIs like MongoDB, Cassandra, and Gremlin. Cosmos’ MongoDB API provides an incomplete emulation of MongoDB using an entirely independent server implementation. MongoDB drivers and tools are not tested against CosmosDB, so if you encounter a compatibility error you should report this to Cosmos support.

Based on the error message you received, it appears that Cosmos’ API does not recognise the Collation support that was introduced in MongoDB 3.4 (November 2016). It looks like collation support has been on Cosmos’ long term road map since about 2 years ago.

If collation (or full MongoDB feature support) is important to your use case, I would consider using MongoDB Atlas on Azure for a managed data service.

The alternative would be to remove all usage of MongoDB features and data types that are not supported by Cosmos, but I’m not aware of a straightforward way to do so. You will also have to adjust your application code and capacity planning to consider Cosmos-specific resource management based on Request Units (RUs).

Regards,
Stennie

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.