-
Type: Improvement
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
How are you using Mongo? What version of the server and driver are you using?
I develop the driver
What is the feature/improvement you would like?
The `parseIndexOptions` has a significant amount of tech debt requiring lots of `any` usage and doesn't have effective narrowing of the various indexSpec shapes possible (e.g, tuple, array of tuples, etc.). It also collects an unused keys property.
What use case would this feature/improvement enable?
It's a quick to clean up and help the next person understand what it is trying to do. It's also missing support for top-level tuple arguments: index(['name', 1])
AC
- Remove the array types from IndexSpecification, OneOrMore already provides array of tuples and array of objects (mappings)
- Refactor forEach to for loop, narrow the types to the three (6) possible cases
- string, tuple, mapping (and then each of those can be passed in as an array)
- consider wrapping the input in an array to make the remainder of the function streamlined, watch out for tuple case
- remove duplicate type handling for index spec shape
- fieldHash continues to track the key to direction mapping.
- Add unit tests for parseIndexOptions
- is related to
-
NODE-4446 Enabling encryption loses sort and createIndexes key order
- Closed