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

dropIndexes squashes all errors to and returns false

    • 0
    • 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

      As a... driver user
      I want... important errors to be surfaced from dropIndexes
      So that... I am alerted if something unexpected happens while using this API

      https://github.com/mongodb/specifications/blob/master/source/index-management/index-management.md#namespacenotfound-errors

      User Experience

      • What is the desired/expected outcome for the user once this ticket is implemented?
        • If the operation succeeds, resolve true. If the operation fails due to name space not found, resolve false. If the operation fails due to any other error, throw the error (reject).
      • If bug: What is the number of impacted customers? How severe is the impact? Is anyone blocked or broken?
        • The current behavior likely doesn't have much impact on existing users, since the manual only calls out the following edge cases as potential errors from this API:

          Starting in MongoDB 6.0, dropIndexes raises an error if you attempt to use it to remove the last remaining shard key compatible index. Passing "*" to dropIndexes drops all indexes except the _id index and the last remaining shard key compatible index, if one exists.

          Starting in MongoDB 5.2, you can use dropIndexes to drop existing indexes on the same collection even if there is a build in progress on another index. In earlier versions, attempting to drop a different index during an in-progress index build results in a BackgroundOperationInProgressForNamespace error.

          However, it's still better not to suppress errors, since if users see unexpected behavior, it's a better experience to be able to tell why from the logs, rather than swallow the error completely, with only "false" ("it failed") to go on.

      Dependencies

      • upstream and/or downstream requirements and timelines to bear in mind

      Risks/Unknowns

      • What could go wrong while implementing this change? (e.g., performance, inadvertent behavioral changes in adjacent functionality, existing tech debt, etc)
      • Is there an opportunity for better cross-driver alignment or testing in this area?
      • Is there an opportunity to improve existing documentation on this subject?

      Acceptance Criteria

      Implementation Requirements

      • The driver should only squash name space not found errors and throw all others; when the name space not found error is squashed, the API should (continue to) return false

      Testing Requirements

      • unit test, spec test sync, etc

      Documentation Requirements

      • DOCSP ticket, API docs, etc

      Follow Up Requirements

      • additional tickets to file, required releases, etc
      • if node behavior differs/will differ from other drivers, confirm with dbx devs what standard to aim for and what plan, if any, exists to reconcile the diverging behavior moving forward

            Assignee:
            Unassigned Unassigned
            Reporter:
            neal.beeken@mongodb.com Neal Beeken
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: