1.5.0
The PHP team is happy to announce that version 1.5.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.2.
Release Highlights
Together with version 1.6.0 of the mongodb
extension, this release allows running multi-document transactions on sharded clusters when connected to MongoDB 4.2.
To make working with transactions easier, this release introduces a new, more convenient API for executing transactions. The new MongoDB\with_transaction()
function takes a MongoDB\Driver\Session
argument and a callback that will be run within a transaction for the given session. The function itself handles starting and committing the transaction, as well as handling any retryable errors that occur during the process.
Change stream iterators now provide a MongoDB\ChangeStream::getResumeToken()
method, which allows retrieving a token that can be used to resume the change stream after the current position. This token can be used with the resumeAfter
option, as well as the new startAfter
option introduced in MongoDB 4.2. The latter allows resuming a change stream after an "invalidate" event, such as dropping or renaming a collection.
Update methods (e.g. updateMany()
, findOneAndUpdate()
) now support passing an aggregation pipeline for the update
argument. This allows for more complex atomic updates than before. See Update with an Aggregation Pipeline in the MongoDB manual for more information on this new feature.
This release adds compatibility with PHP 7.4 and drops support for PHP 5.5.
This release upgrades the mongodb
extension requirement to 1.6.0.
A complete list of resolved issues in this release may be found at: https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=21085
Documentation
Documentation for this library may be found at:
https://docs.mongodb.com/php-library/
Feedback
If you encounter any bugs or issues with this library, please report them via this form:
https://jira.mongodb.org/secure/CreateIssue.jspa?pid=12483&issuetype=1
Installation
This library may be installed or upgraded with:
composer require mongodb/mongodb^1.5.0
Installation instructions for the mongodb
extension may be found in the PHP.net documentation.
Thanks
Thanks for our community contributors for this release: