question

TufekcicDino-7926 avatar image
3 Votes"
TufekcicDino-7926 asked TufekcicDino-7926 commented

Spring-Data annotations on CosmosDB with MongoDB API don't work

Indexing annotations in my Spring Boot application don't work on my Azure CosmosDB with MongoDB API. Using the same annotations directly with a local instance of MongoDB works as expected. This issue was referenced in this post https://docs.microsoft.com/en-us/answers/questions/258032/the-index-path-corresponding-to-the-specified-orde.html but no feedback was offered from MS.

Could someone from MS please respond to the following questions?

  1. Is this is an issue with CosmosDB with Mongo API?

  2. What is the expected time frame for a fix?

  3. Are there any work-arounds other than manually creating indexes?

  4. Possibly unrelated, but creating a composite index from a mongo shell on a CosmosDB instance fails with an 'unsupported' error globaldb:PRIMARY> db.feed.createIndex({"_id.reportDate": -1, "_id.ownerUpn": 1}) { "ok" : 0, "errmsg" : "Unique and compound indexes do not support nested paths.", "code" : 115, "codeName" : "CommandNotSupported" }
    Is this something that will be supported soon? It works with native MongoDB

Thanks
Dino




azure-cosmos-db
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Any update on this from MS reps?

0 Votes 0 ·

I'll look for someone else that may be able to help with this.

0 Votes 0 ·

1 Answer

kobulloc-MSFT avatar image
0 Votes"
kobulloc-MSFT answered TufekcicDino-7926 commented

In response to question 4: "Unique and compound indexes do not support nested paths.", the Azure Cosmos DB Team has said recently (March 9th, 2021) that this is a feature that is currently being worked on. There should be an update once they enter preview or GA:

https://feedback.azure.com/forums/263030-azure-cosmos-db/suggestions/40015003-unique-index-in-nested-documents-or-arrays

· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Great to hear that the nested paths issue is actively worked on. Thanks for letting me know.

What about the issue with Spring Data annotations not working with MongoDB API?

0 Votes 0 ·

That's a good question, and one that falls outside of my area of expertise. @NavtejSaini-MSFT, are you familiar with this scenario?

0 Votes 0 ·

Checking this further.

2 Votes 2 ·
Show more comments