github mongodb/mongo-cxx-driver r4.2.0
MongoDB C++11 Driver r4.2.0

9 hours ago

Important

This release removes and changes the exports of many unstable ABI symbols.
As a reminder, recompilation is required to link with a new release of the unstable ABI for mongo-cxx-driver libraries.

Added

  • Experimental support for stable ABI interfaces under the v1 namespace for both bsoncxx and mongocxx libraries.
  • To support incremental migration, the following entities are defined as equivalent to their renamed counterparts.
    • bsoncxx::types::id: equivalent to bsoncxx::type.
    • bsoncxx::types::binary_subtype: equivalent to bsoncxx::binary_sub_type.
    • bsoncxx::types::view: equivalent to bsoncxx::types::bson_value::view.
    • bsoncxx::types::value: equivalent to bsoncxx::types::bson_value::value.
    • type_view() in bsoncxx::document::element and bsoncxx::array::element: equivalent to get_value().
    • type_value() in bsoncxx::document::element and bsoncxx::array::element: equivalent to get_owning_value().
  • Experimental support for In-Use Encryption Text Indexes (mongocxx::v1::text_options).
  • Change stream helpers for convenient iteration (mongocxx::v1::change_stream::next and mongocxx::v1::change_stream::try_next).

Changed

Important

This release provides an experimental stable ABI for bsoncxx and mongocxx.

  • For consistency with the library and package filenames of MongoDB C Driver 2.0.0 and newer:
    • CMake package config files now use the <name>Config.cmake and <name>ConfigVersion.cmake pattern. (Old: <name>-config.cmake and <name>-config-version.cmake)
  • CMake 3.16.0 or newer is required when ENABLE_TESTS=ON for compatibility with the updated Catch2 library version (3.7.0 -> 3.8.1).
  • Minimum supported compiler versions to build from source are updated to the following:
  • mongocxx::v_noabi::instance::~instance() no longer skips calling mongoc_cleanup() when compiled with ASAN enabled.
  • Bump the minimum required C Driver version to 2.2.3.

Deprecated

  • mongocxx::v_noabi::instance::current() is "for internal use only". The instance constructor(s) should be used instead.
    • Creating the instance object in the scope of main(), or in an appropriate (non-global) scope such that its (non-static) lifetime is valid for the duration of all other mongocxx library operations, is recommended over the following workarounds.
    • If there is only one call to current() present within an application, it may be replaced with a static local variable:
      // Before:
      mongocxx::instance::current();
      
      // After:
      static mongocxx::instance instance; // Only ONE instance object!
    • If there are multiple calls to current() present within an application, they may be replaced with a call to a user-defined function containing the static local variable:
      mongocxx::instance& mongocxx_instance() {
        static mongocxx::instance instance; // Only ONE instance object!
        return instance;
      }
  • These following entities will be renamed (and removed) in an upcoming major release. To support incremental migration, both old and new names are still provided.
    • bsoncxx::type -> bsoncxx::types::id.
    • bsoncxx::binary_sub_type -> bsoncxx::types::binary_subtype.
    • bsoncxx::types::bson_value::view -> bsoncxx::types::view
    • bsoncxx::types::bson_value::value -> bsoncxx::types::value
    • get_value() -> type_view() in bsoncxx::document::element and bsoncxx::array::element.
    • get_owning_value() -> type_value() in bsoncxx::document::element and bsoncxx::array::element.

Removed

Fixed

  • Do not throw when comparing mongocxx::result::insert_many with non-ObjectID IDs.

See the full list of changes in Jira.

Feedback

To report a bug or request a feature, please open a ticket in the MongoDB issue management tool Jira:

Signature Verification

Release artifacts may be verified by using the accompanying detached signature (.asc) and the cpp-driver public key obtained from https://pgp.mongodb.com.

Don't miss a new mongo-cxx-driver release

NewReleases is sending notifications on new releases.