[SERVER-35314] Allow changing default collation for a collection Created: 31/May/18 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Index Maintenance, Querying |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Justin LaBreck | Assignee: | Backlog - Query Execution |
| Resolution: | Unresolved | Votes: | 35 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Assigned Teams: |
Query Execution
|
||||||||||||
| Participants: | |||||||||||||
| Case: | (copied to CRM) | ||||||||||||
| Description |
|
The default collation of a collection may be specified during creation (https://docs.mongodb.com/manual/reference/method/db.createCollection/#db.createCollection). However, there is no way to change the default collation of a collection that already exists. For example, collMod does not allow changing the collation option. This appears intentional:
However, implicit collection creation is more common than explicit. Not allowing default collation changes makes it difficult to discover collation needs later in the development/release cycle and forces large code changes to apply collation to cursors. |
| Comments |
| Comment by Pavel Kalugin [ 06/May/22 ] |
|
Thank you for the try, I'll keep watching this ticket. It's actually an important caveat about the default _id index. We actually tried to work around this issue by using mongoose collation option but it degraded performance of _id queries and we had to roll back |
| Comment by Kyle Suarez [ 06/May/22 ] |
|
After speaking with max.hirschhorn@mongodb.com and the rest of the Query Team, we've concluded that this ticket won't be "quick". The _id index must use the collection's default collation for replication to properly work, so changing the default collation will necessitate an index rebuild. Furthermore we currently don't allow building another _id index with a collation that differs from the collection's default. The Storage Execution team is planning a project that improves the support for index rebuilds, which will be tracked and enabled as part of SERVER-64532. I am going to send this feature request back to the backlog, but we will consider this request again after that dependent project is complete. |
| Comment by Kyle Suarez [ 05/May/22 ] |
|
It's possible we can implement this feature relatively easily as long as we don't affect existing indexes, as the collation affects the on-disk index format. Sending this to the triage queue so that Query Execution can discuss adding this feature to the quick wins bucket. |
| Comment by [ 04/May/22 ] |
|
Same boat - Would simplify our indexes for sure. We didn't have a lot of MongoDb experience when we got started. Now we wish we understood this when we created the collections. It's not something we can really migrate now due to size and being live. |
| Comment by Pavel Kalugin [ 04/May/22 ] |
|
Just wanted to bring some attention to the issue as it is very much wanted by our dev team. We didn't care about performance at the start but now collections are huge and it's hard to migrate from RegExp to collation indexes |
| Comment by Kyle Suarez [ 31/May/18 ] |
|
If we decide we want this feature, we should consider it in tandem with SERVER-27762. |