MongoDB API not recognizing or respecting indexes
- Dominant language
- TypeScript
- Stars
- 131
- Forks
- 67
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 10
Description
Let me start off by saying I am not sure where the best place is for the team that has implemented MongoDB API on Cosmos DB but I figured this would be a good place to start.
I have a document in cosmos that is pretty basic:
```
{ "_id": ObjectId("abc"),
"created_at": {
"$date": 121219271827
},
"status": "pending",
"priority": 1
}
```
I am doing a db.collection.find({status: "pending"}).sort({"created_at":-1, "priority": -1}) and receiving the following error from CosmosDB SDK:
`The order by query does not have a corresponding composite index that it can be served from`
I added both a composite index on created_at and priority via Mongo shell but that didn't work and created a single field index on created_at and priority but still receiving the same message. Is there some guidance on how to get these indexes to be properly recognized? Currently a major blocker for us.
Best,
Dave
Contributor guide
Research direction
No repository file, test, or entry point is identified. Start by reproducing the MongoDB API query and reviewing how Cosmos DB composite and single-field indexes are created and surfaced; done means determining why the indexes are not recognized or documenting the required guidance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mongodb
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100