-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Critical - P2
-
Affects Version/s: None
-
Component/s: Index Management
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
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.
- 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:
Dependencies
- upstream and/or downstream requirements and timelines to bear in mind
Risks/Unknowns
- Users could be relying on valid behaviour today, wherein an error is intended to not be surfaced. This change could be breaking instead of fixing in this case.
Acceptance Criteria
Implementation Requirements
- The driver should only squash name space not found errors and throw all others in dropIndexes; when the name space not found error is squashed, the API should (continue to) return false
Testing Requirements
- Tests should be added to ensure the driver throws
Documentation Requirements
- None
Follow Up Requirements
- https://jira.mongodb.org/browse/NODE-7914 (syync unified spec tests for write-concern-errors)