Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-6029

return type of `indexes()` and `indexInformation()` is inaccurate

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 6.6.0
    • Affects Version/s: None
    • Component/s: TypeScript
    • 0
    • Not Needed
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      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

      Documentation Requirements

      • n/a

      Follow Up Requirements

      • n/a

            Assignee:
            bailey.pearson@mongodb.com Bailey Pearson
            Reporter:
            bailey.pearson@mongodb.com Bailey Pearson
            Bailey Pearson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: