The PHP team is happy to announce that version 1.7.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.4.
Release Highlights
New Client::listDatabaseNames
and Database::listCollectionNames()
methods allow enumeration of database and collection names without returning additional metadata. In the case of collection enumeration, this leverages the nameOnly
option for listCollections
and avoids taking a collection-level lock on the server.
Client::listDatabases()
now supports an authorizedDatabases
option, which can be used with MongoDB 4.0.5 or newer.
The Collection::deleteOne()
, deleteMany()
, and findOneAndDelete()
methods now support a hint
option to specify an index that should be used for the query. This option is also supported for delete operations in bulk writes. This option requires MongoDB 4.4 or later.
The Collection::findOneAndReplace()
and findOneAndUpdate()
methods now support a hint
option, which requires MongoDB 4.2.
Collection::createIndex()
and createIndexes()
now support a commitQuorum
option, which can be used with MongoDB 4.4.
The MongoDB\Operation\Aggregate
class now implements the MongoDB\Operation\Explainable
interface and can be used with Collection::explain()
. This is an alternative to the explain
option supported by Collection::aggregate()
and allows for more verbose output when explaining aggregation pipelines.
The Client constructor now supports a driver
option in its $driverOptions
parameter, which can be used by wrapping drivers and libraries to append metadata (e.g. name and version) to the server handshake. The PHP library will also now append its own name and version to the metadata reported by the mongodb
extension. Note that this feature is primarily designed for custom drivers and ODMs, which may want to identify themselves to the server for diagnostic purposes. Applications should use the appName
URI option instead of driver metadata.
This release upgrades the mongodb
extension requirement to 1.8.0. Support for PHP 5.6 has been removed and the library now requires PHP 7.0 or newer.
A complete list of resolved issues in this release may be found at: Release Notes - MongoDB Jira
Documentation
Documentation for this library may be found at:
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.7.0
Installation instructions for the mongodb
extension may be found in the PHP.net documentation.