0

I have setup Cosmos DB with Mongo API, it contains fell fledged documents. Now I would like to add indexes with weights like how we do in Standalone Mongo DB. Can't this be achieved?

Have tried running the below in the Cosmos shell but says its not supported. Any help in this regard is highly appreciated

db.blog.createIndex( { name: "text", desc: "text", headername: "text" }, { weights: { content: 10, keywords: 5 }, name: "TextIndex" } )

Ravi
  • 9
  • 3

1 Answers1

0

Reproduced your issue on my side. Based on my researching in this link and this link,i'm afraid that add weights for creating index is not supported by cosmos db mongo api indeed.

Per my knowledge, CosmosDB just supports a subset of the MongoDB API. CosmosDB has some different behaviours and results. But the onus is on CosmosDB to improve their emulation of MongoDB.

Surely, you could add feedback here to submit your requirements.Or you could consider using MongoDB Atlas on Azure if you'd like full MongoDB feature support.

Jay Gong
  • 23,163
  • 2
  • 27
  • 32