Skip to content

1.4.0

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

The PHP team is happy to announce that version 1.4.0 of the MongoDB PHP library is now available. This library is a high-level abstraction for the mongodb extension. This release adds support for new features in MongoDB 4.0 and drops support for MongoDB 2.6 and earlier.

Release Highlights

MongoDB 4.0 introduces support for cluster-level and database-level change streams, which may be created via the new MongoDB\Client::watch() and MongoDB\Database::watch() methods, respectively. All change streams now support a startAtOperationTime option, which can be used to specify an exact point in time for the change stream to begin. Additionally, the internal logic for resuming change streams after encountering an error has been improved.

New MongoDB\Collection::countDocuments() and MongoDB\Collection::estimatedDocumentCount() methods have been introduced. countDocuments() may be executed within a transaction and should be preferred where an exact document count is required. estimatedDocumentCount() cannot be executed within a transaction but may otherwise be used when an approximate, non-filtered count is acceptable. The MongoDB\Collection::count() has been deprecated (in documentation only) due to its incompatibility with transactions and inaccuracy in sharded clusters. Users should note that countDocuments() uses an aggregation pipeline instead of the count command, so it does not support $where, $near, and $nearSphere query operators accepted in a count() filter (alternative syntax is discussed in the countDocuments() documentation).

A MongoDB\Collection::explain() method has been introduced as a helper for the explain command, which may be used to explain operations such as find, findAndModify, update, and others. MongoDB\Collection::aggregate() now also supports an explain option (note: the server's API for explaining aggregate differs from other commands).

Several usability improvements were made for the library's model classes for database, collection, and index information. Additionally, a MongoDB\Database::modifyCollection() method has been introduced as a wrapper for the collMod command.

This release upgrades the mongodb extension requirement to 1.5.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=12483&version=19898

Documentation

Documentation for this library may be found at:
https://docs.mongodb.com/php-library/

Installation

This library may be installed or upgraded with:

composer require mongodb/mongodb=^1.4.0

Installation instructions for the mongodb extension may be found in the PHP.net documentation.