[DRIVERS-131] Drivers should only send {w:1} if and when the user has specified. Created: 12/Dec/13  Updated: 15/Apr/19  Resolved: 08/Feb/16

Status: Closed
Project: Drivers
Component/s: None
Fix Version/s: None

Type: Task Priority: Minor - P4
Reporter: Craig Wilson Assignee: Barrie Segal
Resolution: Done Votes: 0
Labels: writeconcern
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on MOTOR-19 Can't force Motor to send w=1 write c... Closed
depends on PYTHON-644 Can't force PyMongo to send w=1 write... Closed
depends on JAVA-1955 Add the ability to distinguish betwee... Closed
Related
related to CXX-182 Add support for Write Concern (outsid... Closed
is related to SERVER-12465 write commands accept empty writeConc... Closed
Driver Compliance:
Key Status/Resolution FixVersion
MOTOR-19 Done 0.4
PYTHON-644 Done 2.8, 3.0
PERL-493 Done 1.0.2
JAVA-1955 Done 3.2.0

 Description   

According the the documentation, a driver should not send any arguments along with GLE (or to the new write commands) unless the user has specified some.

The server interprets a no-arg GLE (or empty document write concern for the new write commands) as an indication to use the server's defaults. If a driver sends

{w:1}

as the "default", then it is always overriding the server's getLastErrorDefaults.

In practice, this is likely not a big deal as a high majority of users don't even know that getLastErrorDefaults exist and, of the ones that do, most wouldn't be changing it. As such, this is a low priority.

Examples:

  1. mongodb://localhost
    • GLE: { getLastError: 1}
    • Write Commands: don't include a writeConcern in the command.
  2. mongodb://localhost?w=0
    • GLE: don't send one
    • Write Commands: { writeConcern : { w: 0 } }. In addition, the driver is responsible for not blocking while waiting on the result.
  3. mongodb://localhost?w=1
    • GLE: { getLastError: 1, w: 1 }
    • Write Commands: { writeConcern: { w: 1 } }
  4. mongodb://localhost?journal=true
    • GLE: { getLastError : 1, j: true }
    • Write Commands: { writeConcern : { j : true } }


 Comments   
Comment by Jeremy Mikola [ 08/Feb/16 ]

Legacy PHP driver should already handle this. PHPC and HHVM handled by libmongoc. Not relevant to PHPLIB.

Comment by Andrew Morrow (Inactive) [ 03/Mar/15 ]

Validating for C++11 since validated for C

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