Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoDB API not recognizing or respecting indexes #1343

Open
0xM4m4n opened this issue Oct 17, 2022 · 0 comments
Open

MongoDB API not recognizing or respecting indexes #1343

0xM4m4n opened this issue Oct 17, 2022 · 0 comments

Comments

@0xM4m4n
Copy link

0xM4m4n commented Oct 17, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant