MongoDB PHP Library 1.17.0 Released

The PHP team is happy to announce that version 1.17.0 of of the MongoDB PHP library is now available.

Release Highlights

This release introduces a new “codec” API for converting BSON to and from PHP objects. Although this feature is implemented entirely in the library, it leverages the extension’s MongoDB\BSON\Document object to work with raw BSON and lazily decode it as necessary. Unlike the extension’s MongoDB\BSON\Serializable and MongoDB\BSON\Unserializable interfaces, codecs allow an application to separate the business logic in a PHP object representing a document from the logic necessary to convert it to/from BSON. To support this feature, a new codec option has been introduced on most classes and methods that currently accept a typeMap option; both options are mutually exclusive. More information on this feature may be found in the Codecs tutorial.

In conjunction with the MongoDB\Driver\Monitoring\LogSubscriber interface introduced in the corresponding extension version, MongoDB\add_logger() and MongoDB\remove_logger() functions have been introduced in the library. These functions allow applications to register a PSR-3 Logger to receive log messages emitted by the driver. Previously, logs were only accessible via the extension’s mongodb.debug INI setting.

Several new MongoDB\Collection methods were introduced to create and manage Atlas Search indexes. Atlas Search indexes can be queried using the $search aggregation pipeline stage, which is supported in all versions of the library.

This release upgrades the mongodb extension requirement to 1.17.0. Support for PHP 7.2 and 7.3 has been removed and the library now requires PHP 7.4 or newer.

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.17.0

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

Thanks

Thanks to our community contributors for 1.17.0:

2 Likes

Builds, but still seg faults at the end of the build. As it has been doing for years … :thinking:

Build process completed successfully
Installing '/usr/lib/php/20210902/mongodb.so'
install ok: channel://pecl.php.net/mongodb-1.17.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=mongodb.so" to php.ini
Segmentation fault

Unfortunately, this is a problem with PECL itself that we can’t do anything about. I don’t remember the exact details, but it has to do with PECL changing the .so file the process is using while it’s running. The good news is that the PHP foundation has plans for improvements in the realm of PHP extensions and PECL, so that issue may eventually go away.

2 Likes

This topic was automatically closed after 90 days. New replies are no longer allowed.