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

Cosmo DB Mongo Collection Order of compound index matters or not #10909

Closed
yupwei68 opened this issue Sep 23, 2020 · 4 comments
Closed

Cosmo DB Mongo Collection Order of compound index matters or not #10909

yupwei68 opened this issue Sep 23, 2020 · 4 comments
Labels
Cosmos Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@yupwei68
Copy link
Contributor

request:
{
"parameters": {
"accountName": "ddb1",
"resourceGroupName": "rg1",
"api-version": "2020-04-01",
"subscriptionId": "subid",
"databaseName": "databaseName",
"collectionName": "collectionName",
"createUpdateMongoDBCollectionParameters": {
"location": "West US",
"tags": {},
"properties": {
"resource": {
"id": "collectionName",
"indexes": [
{
"key": {
"keys": ["testKey" ] <<- Here whether the order of the keys matters
},
"options": {
"expireAfterSeconds": 100,
"unique": true
}
}
],
...
},
"options": {}
}
}
},

@ghost ghost added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Sep 23, 2020
@yupwei68
Copy link
Contributor Author

@MehaKaushik Could you please support us on this question?

@leni-msft leni-msft added Cosmos Service Attention Workflow: This issue is responsible by Azure service team. labels Sep 23, 2020
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Sep 23, 2020
@ghost
Copy link

ghost commented Sep 23, 2020

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @wmengmsft, @MehaKaushik, @shurd, @anfeldma-ms.

@MehaKaushik
Copy link
Contributor

@yupwei68 MongoDB API for CosmosDB follows the same rules as for the MongoDB.

Referencing this https://docs.mongodb.com/manual/core/index-compound/.
"The order of the fields listed in a compound index is important. The index will contain references to documents sorted first by the values of the item field and, within each value of the item field, sorted by values of the stock field. See Sort Order for more information."

To summarize: the order will matter.

@yupwei68
Copy link
Contributor Author

Thanks @MehaKaushik !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cosmos Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

3 participants