-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Catalog and Routing
-
2
-
🟦 Shard Catalog
-
None
-
None
-
None
-
None
-
None
-
None
Today the index specs are unfortunately not IDL-ized and we pass around the specs as a raw BSONObj. The normalize methods for index specs both return and accept the same type, which is a BSONObj. This has led to issues in the past due to calling normalize twice on the same spec, changing the collation type from an explicit simple to the collection's default collation.
A quick way to prevent this is to wrap the returned BSONObj in a newtype-like struct such that we can detect these failures at compilation time due to mismatching types rather than runtime which is much harder to do. It will also help to design a natural entrypoint at which no further modifications to the specs can be done and they have passed all validation layers.