Docs Menu
Docs Home
/ / /
C Driver

What's New

On this page

  • Overview
  • What's New in 2.0.0
  • What's New in 1.30.3
  • What's New in 1.30.0
  • What's New in 1.29.0
  • What's New in 1.28.0
  • What's New in 1.27.6
  • What's New in 1.27.5
  • What's New in 1.27.4
  • What's New in 1.27.3
  • What's New in 1.27.2
  • What's New in 1.27.1
  • What's New in 1.27.0
  • What's New in 1.26.2
  • What's New in 1.26.1
  • What's New in 1.26.0

The MongoDB C Driver consists of two libraries: libbson and libmongoc. On this page, you can learn about the changes, and deprecations made in each version of the driver libraries.

Learn what's new in:

  • Version 2.0.0

  • Version 1.30.3

  • Version 1.30.0

  • Version 1.29.0

  • Version 1.28.0

  • Version 1.27.6

  • Version 1.27.5

  • Version 1.27.4

  • Version 1.27.3

  • Version 1.27.2

  • Version 1.27.1

  • Version 1.27.0

  • Version 1.26.2

  • Version 1.26.1

  • Version 1.26.0

The following sections describe the changes in the 2.0.0 release of the C driver.

Important

Removals

The 2.0.0 driver release removes many deprecated types and methods. To view a full list of removals, see the Removals sections of the v2.0 release notes.

The 2.0.0 release of libbson includes the following changes:

  • Reduces the value of the BSON_ERROR_BUFFER_SIZE macro from 504 to 503 to reserve the final byte for internal use.

  • Renames the following pkg-config files:

    • libbson-1.0: Renamed to bson2

    • libbson-static-1.0: Renamed to bson2-static

  • Removes the bson-1.0 CMake package. Instead, use bson and specify a version or version range to be imported, as shown in the following example:

    find_package(bson 1.30...2.0)
  • Renames the following imported targets:

    • mongo::bson_static: Renamed to bson::static

    • mongo::bson_shared: Renamed to bson::shared

  • Adds the bson::bson target, which points to either the static library or shared library depending on the value of the BSON_DEFAULT_IMPORTED_LIBRARY_TYPE CMake option. If you don't set this option and both library types are available, bson::bson uses the static library.

The 2.0.0 release of libmongoc includes the following changes:

  • If you pass the batchSize:0 option to mongoc_client_watch, mongoc_database_watch, or mongoc_collection_watch, the aggregate command no longer ignores this option and applies it.

  • Removes bson_oid_init_sequence. Instead, use bson_oid_init.

  • Changes the return type of mongoc_server_description_host from mongoc_host_list_t * to const mongoc_host_list_t *.

  • Implements the following changes to URI authentication credentials validation, which apply when creating a new mongoc_uri_t object from a connection string:

    • Requires that usernames are non-empty for all authentication mechanisms.

    • Validates username and password specification requirements and returns a client error for the specified authentication mechanism.

    • For the MONGODB-AWS authentication mechanism, the authSource value defaults to $external.

    • Validates authMechanism values and returns a client error for invalid values.

    • Validates authMechanismProperties values and returns a client error for invalid properties for the specified authentication mechanism.

    • Correctly parses colon (:) characters within authMechanismProperties values. For example, setting authMechanismProperties=A:B,C:D:E,F:G caused the driver to parse the value as {'A': 'B', 'C': 'D:E,F:G'}. This is now parsed as {'A': 'B': 'C': 'D:E', 'F': 'G'}.

  • Generates an error if you call mongoc_bulk_operation_execute on the same mongoc_bulk_operation_t repeatedly.

  • Consistently applies the __cdecl calling convention to function declarations in the public API.

  • mongoc_client_set_ssl_opts ignores a pooled mongoc_client_t and logs an error. Before popping a client, use mongoc_client_pool_set_ssl_opts to set TLS options on a mongoc_client_pool_t.

  • mongoc_client_set_ssl_stream_initiator ignores a pooled mongoc_client_t and logs an error.

  • Renames the following pkg-config files:

    • libmongoc-1.0: Renamed to mongoc2

    • libmongoc-static-1.0: Renamed to mongoc2-static

  • Removes the mongoc-1.0 CMake package. Instead, use mongoc and specify a version or version range to be imported, as shown in the following example:

    find_package(mongoc 1.30...2.0)
  • Renames the following imported targets:

    • mongo::mongoc_static: Renamed to mongoc::static

    • mongo::mongoc_shared: Renamed to mongoc::shared

  • Adds the mongoc::mongoc target, which points to either the static library or shared library depending on the value of the MONGOC_DEFAULT_IMPORTED_LIBRARY_TYPE CMake option. If you don't set this option and both library types are available, mongoc::mongoc uses the static library.

For more information about this release, see the v2.0 release notes.

The following sections describe the changes in the 1.30.3 release of the C driver.

The 1.30.3 release of libbson includes the following changes:

  • In anticipation of the v2.0 release, adds new CMake packages and imported targets for bson to allow you to support both major versions without modifying your CMake project.

    • To import bson with the new names, call find_package for the bson package. The new imported target names are bson::static, bson::shared, and bson::bson.

The 1.30.3 release of libmongoc includes the following changes:

  • In anticipation of the v2.0 release, adds new CMake packages and imported targets for bson and mongoc to allow you to support both major versions without modifying your CMake project.

    • To import mongoc with the new names, call find_package for the mongoc package. The new imported target names are mongoc::static, mongoc::shared, and mongoc::mongoc.

    • To import bson with the new names, call find_package for the bson package. The new imported target names are bson::static, bson::shared, and bson::bson.

For more information about this release, see the v1.30.3 release notes.

The following sections describe the changes in the 1.30.0 release of the C driver.

The 1.30.0 release of libbson includes the following changes:

  • Deprecates support for Debian 9 and Debian 10

  • Improves the performance of BSON to JSON serialization for nested documents

  • Updates the truncated output of the bson_as_json_with_opts() function to no longer split valid UTF-8 sequences

  • Updates generated JSON text in the following ways:

    • Serializes all empty arrays and documents with one space

    • Serializes arrays that the driver omits because of the maximum recursion limit to [ ... ] instead of { ... }

    • Applies the maximum recursion limit to legacy CodeWScope documents

  • Fixes an output parameter leaked after unsuccessful calls to the bson_append_array_builder_begin() function

The 1.30.0 release of libmongoc includes the following changes:

  • Deprecates support for Debian 9 and Debian 10

  • Adds support for structured logging. To configure this feature, use the mongoc_client_set_structured_log_opts() and mongoc_client_pool_set_structured_log_opts() functions.

  • Adds support for cache lifetime configuration of In-Use Encryption data encryption keys. To configure this feature, use the mongoc_auto_encryption_opts_set_key_expiration() and mongoc_client_encryption_opts_set_key_expiration() functions.

    To learn more about In-Use Encryption, see In-Use Encryption in the MongoDB Server manual.

  • Adds support for the sort option for update and replace operations.

  • Adds support for constructing a mongoc_bulkwrite_t type without a client by using the mongoc_bulkwrite_new() and mongoc_bulkwrite_set_client() functions.

  • Improves the performance of the mongoc_server_description_new_copy() function

  • Includes the following APM event fixes required by the SDAM specification:

    • After delivering a server_opening event, the driver must deliver a corresponding server_closed event before delivering topology_closed

    • Before delivering a topology_closed event, the driver delivers a topology_changed event that has a new_description of type Unknown

  • Fixes possible crashes when the driver reports the inserted document IDs in the verbose results of client bulk writes

For more information about this release, see the v1.30 release notes.

The 1.29.0 release of the C driver includes several changes.

The 1.29.0 release of libbson includes the following changes:

  • Deprecates the bson_string_t and associated functions

  • Deprecates compiling with BSON_MEMCHECK

  • Deprecates bson_in_range_*() and bson_cmp_*() functions

  • Deprecates bson_atomic_*() and bson_thrd-yield() functions

  • Deprecates bson_as_json() and bson_array_as_json() functions

The 1.29.0 release of libmongoc includes the following changes:

  • Deprecates mongoc_client_command. Use mongoc_client_command_simple instead.

  • Deprecates mongoc_database_command. Use mongoc_database_command_simple instead.

  • Deprecates mongoc_collection_command. Use mongoc_collection_command_simple instead.

  • Drops support for Visual Studio 2013

  • Raises required version of the libmongocrypt dependency to 1.12.0 to support the In-Use Encryption feature

For more information about this release, see the v1.29 release notes.

The 1.28.0 release of the C driver includes several changes.

The 1.28.0 release of libbson includes the following changes:

  • Adds bson_validate_with_error_and_offset() function

  • Removes automatic ccache detection and usage

  • Removes Mongo_USE_CCACHE

  • Adds support for In-Use Encryption range queries

  • mongoc_collection_insert_one includes the insert ID

  • Adds new bulk write API mongoc_bulkwrite_t

  • Adds serverMonitoringMode URI option

  • Raises minimum wire protocol version from 6 to 7

  • Raises required libmongocrypt version to v1.11.0 to support In-Use Encryption

  • Deprecates *_hint option. Instead, use the *_server_id option.

    • Deprecates mongoc_bulk_operation_set_hint. Instead, use mongoc_bulk_operation_set_server_id.

    • Deprecates mongoc_bulk_operation_get_hint. Instead, use mongoc_bulk_operation_get_server_id.

    • Deprecates mongoc_cursor_set_hint. Instead, use mongoc_cursor_set_server_id.

    • Deprecates mongoc_cursor_get_hint. Instead, use mongoc_cursor_get_server_id .

  • Deprecates ENABLE_SSL=LIBRESSL and mongoc_stream_tls_libressl_new.

  • Deprecates ENABLE_SASL=CYRUS and the CYRUS_PLUGIN_PATH_PREFIX option on Windows platforms.

For more information about this release, see the v1.28 release notes.

The 1.27.6 release of the C driver includes several changes.

The 1.27.6 release of libbson includes the following changes:

  • Fixes handling of malformed extended JSON for special BSON types

The 1.27.6 release of libmongoc includes the following changes:

  • Fixes TSan warning

  • Fixes C23 compile

  • Documents expected behavior of command errors in a transaction

The 1.27.5 release of the C driver includes several changes.

The 1.27.5 release of libbson includes the following changes:

  • Fixes large string handling in bson_append_utf8

The 1.27.5 release of libmongoc includes the following changes:

  • Fixes possible build error in environments where bool or _Bool is a macro

The 1.27.4 release of the C driver includes several changes.

The 1.27.4 release of libbson includes the following changes:

  • Fixes build issues with Visual Studio 2013

The 1.27.4 release of libmongoc includes the following changes:

  • Fixes possible crash reading malformed wired protocol message

  • Fixes build issues with Visual Studio 2013

The 1.27.3 release of the C driver includes several changes.

The 1.27.3 release of libbson includes the following changes:

  • Introduces changes surrounding the development processes, including new code signing and dependency tracking. There are no behavioral or API changes.

The 1.27.3 release of libmongoc includes the following changes:

  • Upgrades bundled Zlib from 1.2.3 to 1.3.1

The 1.27.2 release of the C driver includes several changes.

The 1.27.2 release of libbson includes the following changes:

  • Fixes parsing of colon in timezone

  • Fixes error on failure to initialize a subdocument in bson_iter_visit_all

The 1.27.2 release of libmongoc includes the following changes:

  • Closes leftover connections to remote servers

  • Checks environment variable MONGO_EXPERIMENTAL_SRV_PREFER_TCP to prefer TCP over SRV lookup

The 1.27.1 release of the C driver includes several changes.

The 1.27.1 release of libbson includes the following changes:

  • Fixes large string handling in bson_string_new and bson_string_append

This version is incremented to match the libbson version, but there are no changes since 1.27.0.

The 1.27.0 release of the C driver includes several changes.

This version is incremented to match the libbson version, but there are no changes since 1.26.2.

The 1.27.0 release of libmongoc includes the following changes:

  • Raises the required version of libmongocrypt to 1.10.0 to support In-Use Encryption. This corresponds to CMake option ENABLE_CLIENT_SIDE_ENCRYPTION.

  • Fixes possible crash when client is configured with an empty password

  • Adds database name to command events mongoc_apm_command_failed_get_database_name and mongoc_apm_command_succeeded_get_database_name

  • Supports delegated KMIP protocol for In-Use Encryption

  • Enables setting socket timeout per client

The 1.26.2 release of the C driver includes several changes.

The 1.26.2 release of libbson includes the following changes:

  • Fixes iteration on bson_strfreev

The 1.26.2 release of libmongoc includes the following changes:

  • By default, disables plugin loading with Cyrus SASL on Windows. To re-enable, set the CMake option CYRUS_PLUGIN_PATH_PREFIX to the absolute path prefix of the Cyrus SASL plugins.

  • Fixes possible hang if mongoc_gridfs_file_readv is called with a corrupt chunk with incomplete data

  • Fixes assert with legacy exhaust cursor protocol when connected to MongoDB server versions earlier than 4.2

The 1.26.1 release of the C driver includes several changes.

The 1.26.1 release of libbson includes the following changes:

  • Uses aligned allocation for bson_array_builder_t

The 1.26.1 release of libmongoc includes the following changes:

  • Fixes 32-bit compile with 64-bit time_t

The 1.26.0 release of the C driver includes several changes.

This version is incremented to match the libmongoc version, but there are no changes since 1.25.4.

The 1.26.0 release of libmongoc includes the following changes:

  • Supports named KMS providers

  • Redirects retries in sharded clusters to another mongos if possible

  • Adds VERSION_CURRENT file in source to ease building

  • Considers more errors retryable

Back

Operations on Replica Sets