[CDRIVER-3630] Raise error when hint option is provided on unacknowledged writes against any server version Created: 20/Apr/20  Updated: 15/Jun/22  Resolved: 22/Jul/20

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Backlog - Core Eng Program Management Team Assignee: Andreas Braun
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by CXX-2002 Raise error when hint option is provi... Closed
Related
is related to CDRIVER-4127 Allow hint for unacknowledged writes ... Closed

 Description   

A previous version of the CRUD spec said that the driver should only raise errors when the hint option is provided to an unacknowledged write against a server that does not support the hint option. However, the CRUD spec also says that the driver should raise errors whenever the arrayFilters or collation options are provided on any unacknowledged write. The spec has been changed to state that the driver should raise an error when the hint option is provided on unacknowledged writes against any server version.



 Comments   
Comment by Githook User [ 21/Jun/21 ]

Author:

{'name': 'Jeremy Mikola', 'email': 'jmikola@gmail.com', 'username': 'jmikola'}

Message: CDRIVER-3895: Remove dots/dollars validation for insert/replace docs (#801)

  • CDRIVER-3895: Update CRUD, transactions, and unified spec tests

Also replaces CRUD legacy/v2 tests with unified equivalents for CDRIVER-3960.

Synced with mongodb/specifications@a124e21be89cbfc78606725c6ed1fa00dc992777

  • Ensure upsertedIds is always present in BulkWriteResult
  • Allow array or document for updateOne/Many update arg
  • Remove dot/dollar restrictions for insert/replace validation

This adds top-level key validation to _mongoc_validate_replace, similar to what existed in _mongoc_validate_update.

  • Remove redundant replace doc validation for legacy updates

Replacement docs will already be validated by _mongoc_validate_replace before this function is reached.

This adds logic to ensure "q" and "u" documents are present, similar to what existed in _mongoc_write_command_delete_legacy.

  • Test success and failure for legacy update code path

The failure code path is testing that arguments are still validated by mongoc-util.c, despite replacement validation being removed in a previous commit.

  • Revert "Skip tests with dots and dollars in field names on 5.0+ (#795)"

This reverts commit bd014ee7995420d5d1d2db8a10348f0b24d09090.

  • Revise bulk and collection tests for allowing dots/dollars

Empty keys can be used as a reliable BSON validation error, since insert, replace, and update all specify BSON_VALIDATE_EMPTY_KEYS in their vflags. Error message expectations are adjusted accordingly.

An _id document with a dollar-prefixed key is also used as a reliable server-side validation error.

  • Allow methods in bulk_op_append to fail so expectError can be evaluated
  • Skip unified tests due to schema version and outstanding issues

Allow entire files to be skipped to preempt schema version errors.

  • Ensure WC is set on database and collection entities

Co-authored-by: Kevin Albertson <kevin.albertson@10gen.com>
Branch: r1.18
https://github.com/mongodb/mongo-c-driver/commit/4069b7984d3b089195d4c7ff1fd58c3d6bc2aedc

Comment by Githook User [ 16/Jun/21 ]

Author:

{'name': 'Jeremy Mikola', 'email': 'jmikola@gmail.com', 'username': 'jmikola'}

Message: CDRIVER-3895: Remove dots/dollars validation for insert/replace docs (#801)

  • CDRIVER-3895: Update CRUD, transactions, and unified spec tests

Also replaces CRUD legacy/v2 tests with unified equivalents for CDRIVER-3960.

Synced with mongodb/specifications@a124e21be89cbfc78606725c6ed1fa00dc992777

  • Ensure upsertedIds is always present in BulkWriteResult
  • Allow array or document for updateOne/Many update arg
  • Remove dot/dollar restrictions for insert/replace validation

This adds top-level key validation to _mongoc_validate_replace, similar to what existed in _mongoc_validate_update.

  • Remove redundant replace doc validation for legacy updates

Replacement docs will already be validated by _mongoc_validate_replace before this function is reached.

This adds logic to ensure "q" and "u" documents are present, similar to what existed in _mongoc_write_command_delete_legacy.

  • Test success and failure for legacy update code path

The failure code path is testing that arguments are still validated by mongoc-util.c, despite replacement validation being removed in a previous commit.

  • Revert "Skip tests with dots and dollars in field names on 5.0+ (#795)"

This reverts commit bd014ee7995420d5d1d2db8a10348f0b24d09090.

  • Revise bulk and collection tests for allowing dots/dollars

Empty keys can be used as a reliable BSON validation error, since insert, replace, and update all specify BSON_VALIDATE_EMPTY_KEYS in their vflags. Error message expectations are adjusted accordingly.

An _id document with a dollar-prefixed key is also used as a reliable server-side validation error.

  • Allow methods in bulk_op_append to fail so expectError can be evaluated
  • Skip unified tests due to schema version and outstanding issues

Allow entire files to be skipped to preempt schema version errors.

  • Ensure WC is set on database and collection entities

Co-authored-by: Kevin Albertson <kevin.albertson@10gen.com>
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/2597f6d4d229f437b3b2cdce0e941a925f24491d

Comment by Jeremy Mikola [ 22/Jul/20 ]

This was originally created to track DRIVERS-991, but that issue has been superseded by DRIVERS-1340.

Comment by Jeremy Mikola [ 22/Jul/20 ]

andreas.braun: When I asked about this in Slack, I incorrectly associated https://github.com/mongodb/specifications/pull/774 (which you did review) with DRIVERS-991 instead of DRIVERS-970. The PR for DRIVERS-991 was https://github.com/mongodb/specifications/pull/789 (which you did not review).

DRIVERS-991 and SPEC-1664 were both created after CDRIVER-3552 was merged, so there's no way you could have implemented the logic to reject hint on all w:0 writes. That's reassuring, since I'd like to revert that in DRIVERS-1340.

I'm going to re-open this and related CXX and PHPC language tickets for DRIVERS-991 and resolve them as "Won't Fix" in light of DRIVERS-1340.

Comment by Andreas Braun [ 22/Jul/20 ]

Done in https://github.com/mongodb/mongo-c-driver/commit/1b9ce0d3d

Generated at Wed Feb 07 21:18:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.