[CDRIVER-2304] Deprecate mongoc_collection_update Created: 27/Sep/17  Updated: 28/Oct/23  Resolved: 30/Oct/17

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

Type: Improvement Priority: Minor - P4
Reporter: Kevin Albertson Assignee: A. Jesse Jiryu Davis
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on CDRIVER-2265 Overly validating documents in bulk i... Closed
Related
related to CDRIVER-3054 Deprecate mongoc_collection_update an... Backlog

 Description   

mongoc_collection_update does not take a bson_t for options, but instead appends options to the command based on options from the flags argument (for multi, and upsert).

Unfortunately there is no way to pass "collation" or "arrayFilters" to this function. We should deprecate use of this function after creating new functions mongoc_collection_update_one_with_opts and mongoc_collection_update_many_with_opts.



 Comments   
Comment by A. Jesse Jiryu Davis [ 30/Oct/17 ]

Closing. I'm not going to mark mongoc_collection_update with BSON_GNUC_DEPRECATED_FOR since that could cause more disruption than it's worth in users' code. Kevin has documented it:

Superseded by :symbol:`mongoc_collection_update_one_with_opts`, :symbol:`mongoc_collection_update_many_with_opts`, and :symbol:`mongoc_collection_replace_one_with_opts`.

It's ok for mongoc_collection_save to continue calling this superseded function, in any case, since mongoc_collection_save itself is actually deprecated. If there is ever a libmongoc 2.0 we can choose to delete mongoc_collection_save and mongoc_collection_update simultaneously.

Comment by Githook User [ 25/Oct/17 ]

Author:

{'email': 'jesse@mongodb.com', 'name': 'A. Jesse Jiryu Davis', 'username': 'ajdavis'}

Message: Merge remote-tracking branch 'upstream/master'

Comment by Kevin Albertson [ 16/Oct/17 ]

I did not add the BSON_GNUC_DEPRECATED_FOR to collection_update because it is
currently used by collection_save.

If I were to replace this call with collection_update_one or
collection_replace_one, this would change behavior. Why? Because it uses
MONGOC_UPDATE_NO_VALIDATE to skip validation when calling collection_update. The
update_one/replace_one functions do not yet allow skipping validation. This depends on the work done in CDRIVER-2265.

If we do add an option, than we can easily replace the call to collection_update
with collection_update_one and skip validation. If we do not, then we'd have to
check in collection_save whether to call replace or update.

Comment by Githook User [ 16/Oct/17 ]

Author:

{'email': 'kevin.albertson@10gen.com', 'name': 'Kevin Albertson', 'username': 'kevinAlbs'}

Message: CDRIVER-2304 remove collection_update from docs
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/33575cabc102de5cb44595a402a06524155f2774

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