[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:
Related
is related to DRIVERS-1340 Allow hint for unacknowledged writes ... Implementing
Driver Changes: Not Needed

 Description   

Summary

Write 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.

Motivation

Who 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: DRIVERS-1899: Permit optional results for unacknowledged write concerns (#1130)

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>
Branch: master
https://github.com/mongodb/specifications/commit/6ed902420587464f49fa483ff3575afb9f560f00

Generated at Thu Feb 08 08:24:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.