Skip to content

1.5.0

Compare
Choose a tag to compare
@jmikola jmikola released this 27 Jun 16:23

The PHP team is happy to announce that version 1.5.0 of the mongodb PHP extension is now available on PECL. This release adds support for new features in MongoDB 4.0 and drops support for MongoDB 2.6 and earlier.

Release Highlights

This release adds support for MongoDB 4.0 and with that its main new feature: multi-document transactions for replica sets. The MongoDB\Driver\Session class now has methods to start, commit, and abort transactions. After starting a transaction, the session object may be passed as an option to executed commands, queries, and write operations to associate those operations with the transaction. Other new server features, such as SCRAM-SHA-256 authentication, are also supported.

This driver release introduces a significant enhancement to the driver's type map functionality for BSON deserialization. In addition to configuring a PHP type for root documents, embedded documents, and arrays, it is now possible to configure types for specific field paths within the BSON document. More information on this may be found in the driver's BSON deserialization documentation.

The driver's exception hierarchy has been improved so that users can better identify errors originating from the server. If an exception is an instance of a MongoDB\Driver\Exception\ServerException, the driver guarantees that its exception code originates from the server (it should match a known server error code). A new MongoDB\Driver\Exception\CommandException has been introduced for command errors and provides access to the command's original response document.

Some configure options for building the driver from source have changed. The internal --enable-developer-flags and --enable-coverage options have been renamed to --enable-mongodb-developer-flags and --enable-mongodb-coverage. --with-mongodb-sasl no longer accepts a directory string as we now use pkg-config to search for Cyrus SASL (as we do for SSL libraries). A --with-mongodb-icu option has been introduced, which defaults to "auto". ICU is required for SASLPrep, which may used for SCRAM-SHA-256 authentication.

Lastly, this release introduces a MongoDB\BSON\Int64 class expressly to allow 64-bit integers from BSON to be represented on 32-bit platforms. Previously, the driver would throw an exception if a 64-bit integer would overflow PHP's native integer size. This new class enabled a 64-bit integer to be roundtripped through a 32-bit PHP environment without any loss of precision and also allows its value to be accessed as a string.

This release upgrades our libbson and libmongoc dependencies to 1.11.0. Support for MongoDB 2.6 and earlier has been removed.

A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12484&version=19415

Documentation

Documentation is available on PHP.net:
http://php.net/set.mongodb

Installation

You can either download and install the source manually, or you can install the extension with:

pecl install mongodb

or update with:

pecl upgrade mongodb

Windows binaries are available on PECL:
http://pecl.php.net/package/mongodb