Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-1229

Fix incorrect constness in several places

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: API
    • Labels:
      None

      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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            sam.rossi@mongodb.com Samuel Rossi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: