I'm pleased to announce version 1.4.0 of libbson and libmongoc, the libraries constituting the MongoDB C Driver.
libbson
New features and bug fixes:
This release tentatively supports the new BSON decimal type when built with "./configure --enable-experimental-features", or with "cmake -DENABLE_EXPERIMENTAL_FEATURES=ON", but this feature may change between now and libbson 1.5.
libmongoc
TLS
The driver can now use the native TLS and crypto functions included in Mac OS X and Windows. OpenSSL is no longer required for TLS or authentication on Mac or Windows. By default, OpenSSL is used if available, the default will switch in version 2.0 to prefer native TLS.
For native TLS on Mac:
./configure --enable-ssl=darwin
For Windows:
cmake "-DENABLE_SSL=WINDOWS" -G "Visual Studio 10 Win64" "-DCMAKE_INSTALL_PREFIX=C:\mongo-c-driver"
All of the TLS implementations now load the native default certificate store, with OpenSSL on Windows falling back on the Windows native certificate store if no other can be found.
The "ca_dir" field on mongoc_ssl_opt_t is only supported by OpenSSL. All other fields, including "pem_file", are supported by all implementations.
A new field, "allow_invalid_hostname", has been added to mongoc_ssl_opt_t and is preferred over the existing "allow_invalid_certificate" to disable hostname verification.
See the documentation for mongoc_ssl_opt_t for details.
The driver now supports the latest OpenSSL 1.1 in addition to past versions.
Application Performance Monitoring
The driver implements the MongoDB Command Monitoring Spec. Applications can record the duration and other details of every operation the driver performs on the server. See "Introduction to Application Performance Monitoring" in the docs.
Error API
New functions mongoc_client_set_error_api and mongoc_client_pool_set_error_api allow applications to distinguish client and server errors. See the "Error Reporting" doc.
Unacknowledged Write Results
Unacknowledged writes (writes whose mongoc_write_concern_t "w" value is zero) now reply with an empty document instead of one with nInserted: 0, nUpdated: 0, and so on.
Command functions now ignore the read preferences set on a client, database, or collection. Instead, they use the mongoc_read_prefs_t passed in explicitly, or default to "primary". This change was made to bring them in line with the Server Selection Spec. These are the affected functions:
On the other hand, the following command-specific helper functions now use the collection's read preference:
New functions to send maxTimeMS or any arbitrary options with findAndModify:
New function to include a write concern with a generic command function like mongoc_client_command_simple:
Public API For Higher-Level Drivers
New functions support language drivers (specifically the PHP and HHVM drivers) using only the libmongoc public API:
Now that these public APIs are available, the PHP drivers no longer define the MONGOC_I_AM_A_DRIVER preprocessor symbol to access private APIs. The symbol is removed from C Driver headers, and libmongoc-priv.so is no longer installed.
Other Features
Deprecations
Automatically calling mongoc_init and mongoc_cleanup is a GCC-specific feature that is now deprecated, and will be removed in version 2. The driver should be built with:
./configure --disable-automatic-init-and-cleanup
Or:
cmake "-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF" -G "Visual Studio 10 Win64" "-DCMAKE_INSTALL_PREFIX=C:\mongo-c-driver"
In this configuration, applications must explicitly init and cleanup libmongoc.
Deprecated functions:
Notable Bug Fixes
Links:
Acknowledgments
Thanks to everyone who contributed to this release.
Peace,
-- A. Jesse Jiryu Davis