-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: TypeScript
Use Case
`Collection.indexes()` and `Collection.indexInformation()` list index information for users. They both support an option, `full`:
- when `true`, these APIs return the array of indexes returned from `listIndexes()`.
- when `false`, these APIs aggregate the index information into an object and return the object.
Their signatures are:
async indexes(options?: IndexInformationOptions): Promise<Document[]> async indexInformation(options?: IndexInformationOptions): Promise<Document>
The correct signatures are probably:
async indexes(options?: IndexInformationOptions): Promise<Document[] | Document> async indexInformation(options?: IndexInformationOptions): Promise<Document[] | Document>
User Impact
- Users may be getting Typescript errors using `indexes()` or `indexInformation()`.
Dependencies
- n/a
Unknowns
- n/a
Acceptance Criteria
Implementation Requirements
- Update the return type of these APIs to reflect that when `full` is false, an object is returned and when `full` is true, and array is returned.
Testing Requirements
- type tests. this behavior is covered with integration tests after https://github.com/mongodb/node-mongodb-native/pull/4034
Documentation Requirements
- n/a
Follow Up Requirements
- n/a