Type: New Feature
Priority: Major - P3
Affects Version/s: None
Fix Version/s: None
Security Level: Public
Last comment by Customer:false
When talking with server 3.4 or greater (maxWireVersion >=5), writeConcern should be a supported option for commands that write.
Helpers for the following commands therefore must be updated to support the option.
These are commands that newly accept a writeConcern as of 3.4, for which driver helpers should be updated:
- aggregate with $out
- mapReduce with out
When the writeConcern on a command that writes fails, the resulting document still comes back with ok: 1. Hence, to check for write concern and raise the appropriate error to your users, you will need to check the resulting document for a writeConcernError field. If it is present, then writeConcern failed.
See the specs here for details on writeConcern with the generic command method. See the specs here for details on handling writeConcern with command helpers.