-
Type: Sub-task
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
Use Case
As a Node driver engineer,
I want simpler index management internals,
So that it is easier to maintain our index management code in the future.
User Impact
- n/a - internal refactor
Dependencies
- n/a
Unknowns
- n/a
Acceptance Criteria
Implementation Requirements
- Convert index_management.test.js to Typescript
- Convert index_management.test.js to async/await
- Remove the `EnsureIndex` class
- This class is unused and marked internal.
- Remove the `CreateIndexOperation` class
- Rationale: this class is a subclass of CreateIndexesOperation that only does two things:
- maps the input type of `Collection.createIndex()` to the input type of `Collection.createIndexes()`
- returns the first item in the list of returned indexes
- Now that we're using async-await, this can easily be removed and we can simply await the result of executing a `CreateIndexesOperation` and return the first item in the array in the collection's `CreateIndex` helper.
- Rationale: this class is a subclass of CreateIndexesOperation that only does two things:
- Remove the three `ListIndexes` wrappers:
- IndexInformationOperation, IndexExistsOperation and IndexesOperation all perform a `Collection.listIndexes(..).toArray()` internally, and then transform the response. We can remove these classes and instead operate directly on the result of `listIndexes(..).toArray()`.
Testing Requirements
- ensure all tests pass.
Documentation Requirements
- n/a
Follow Up Requirements
- n/a