[CXX-1229] Fix incorrect constness in several places Created: 24/Feb/17  Updated: 08/Feb/23

Status: Backlog
Project: C++ Driver
Component/s: API
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Samuel Rossi (Inactive) Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CXX-869 mongocxx::result::insert_many::insert... Closed
Epic Link: CXX ABI
Quarter: FY24Q1

 Description   

While auditing the codebase for incorrect usage of constness, we found several places where fixing issues would break the API.

Methods incorrectly marked as const:

  • mongocxx::client::list_databases() - calls mongoc_database_has_collection, which takes a non-const pointer to a mongoc_database_t
  • mongocxx::collection::list_indexes() - connects to the server through libmongoc, which is not threadsafe
  • mongocxx::insert_many_builder::insert() - non-threadsafe and will yield different results when called subsequently on the same collection

Additionally, the getter mongocxx::options::bulk_write::bypass_document_validation() should return a const ref, as the other getters return const refs.


Generated at Wed Feb 07 22:01:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.