MongoDB PHP Library 1.13.0 Released

The PHP team is happy to announce that version 1.13.0 of the MongoDB PHP library is now available. This release introduces support for MongoDB 6.0 and Queryable Encryption.

Release Highlights

MongoDB\Database::createCollection , MongoDB\Database::dropCollection , and MongoDB\Collection::drop now support an encryptedFields option. This is used by the library to manage internal collections used for queryable encryption.

Helper methods for find , findAndModify , delete , and update commands now support a let option, which can be used to define variables that can be accessed within query filters and updates. Additionally, all helpers now support a comment option of any type (previously a string comment was only supported for queries).

Change Streams with Document Pre- and Post-Images are now supported. Change stream watch() helpers now accept “whenAvailable” and “required” for the fullDocument option and support a new fullDocumentBeforeChange option, which accepts “whenAvailable” and “required”. Change events may now include a fullDocumentBeforeChange response field. Additionally, MongoDB\Database::createCollection() and MongoDB\Database::modifyCollection() now support a changeStreamPreAndPostImages option to enable this feature on collections. Lastly, change stream watch() helpers now accept a showExpandedEvents option to enable the server to return additional events for DDL operations (e.g. creating indexes and collections) in the change stream.

MongoDB\Database::createCollection() now supports creating clustered indexes and views. Clustered indexes were introduced in MongoDB 5.3. Views date back to MongoDB 3.4 but the corresponding options for the create command were never added to the library’s helper method.

MongoDB\Collection::estimatedDocumentCount() has been changed to always use the count command. In a previous release (1.9.0), the method was changed to use aggregate with a $collStats stage instead of the count command, which did not work on views. Reverting estimatedDocumentCount() to always use the count command addresses the incompatibility with views. Due to an oversight, the count command was omitted from the Stable API in server versions 5.0.0–5.0.8 and 5.1.0–5.3.1. Users of the Stable API with estimatedDocumentCount are advised to upgrade their MongoDB clusters to 5.0.9+ or 5.3.2+ (if on Atlas) or disable strict mode when using MongoDB\Driver\ServerApi .

This release upgrades the mongodb extension requirement to 1.14.0.

A complete list of resolved issues in this release may be found in JIRA

Documentation

Documentation for this library may be found in the PHP Library Manual.

Installation

This library may be installed or upgraded with:

composer require mongodb/mongodb:1.13.0

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

1 Like