[DRIVERS-1899] Write results should be optional to accommodate unacknowledged write concerns Created: 26/Aug/21 Updated: 28/Oct/23 Resolved: 28/Jan/22 |
|
| Status: | Closed |
| Project: | Drivers |
| Component/s: | CRUD |
| Fix Version/s: | None |
| Type: | Spec Change | Priority: | Unknown |
| Reporter: | Jeremy Mikola | Assignee: | Jeremy Mikola |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Driver Changes: | Not Needed | ||||||||
| Description |
SummaryWrite Results states that the acknowledged property on result objects exists for languages that do not return an optional type. This implies that those write methods should actually be documented as returning an optional (e.g. bulkWrite should return Optional<BulkWriteResult>). Note that findAndModify operations may need similar clarifications (permitting an optional or null return value), as the spec currently documents those methods are returning a non-optional Document (findAndModify with {w:0} comes back with a {ok:1} response and would not have any document to return). This came up while working on DRIVERS-1340. MotivationWho is the affected end user?Driver authors. This ticket is strictly a clarification and should have no impact on driver APIs or users. Is this issue urgent?No. Is this ticket required by a downstream team?No. Is this ticket only for tests?No. This ticket only pertains to the spec language. Any unified tests that do assert results for unacknowledged writes should utilize $unsetOrMatches on the expected result. |
| Comments |
| Comment by Githook User [ 28/Jan/22 ] |
|
Author: {'name': 'Jeremy Mikola', 'email': 'jmikola@gmail.com', 'username': 'jmikola'}Message: For write commands, this was previously inferable by existing documentation for the "acknowledged" property of Write Results. Likewise for findAndModify, comments suggested that the return value could be null. This change makes the documentation more explicit. Also adds explicit documentation that InsertOneResult and InsertManyResult are not required, which was previously inferable. Co-authored-by: Benjamin Rewis <32186188+benjirewis@users.noreply.github.com> |