Releases: mongodb/mongo-php-driver
1.1.5
The PHP team is happy to announce that version 1.1.5 of our new mongodb PHP extension is now available on PECL.
Release Highlights
This release fixes a segfault that several users had experienced running the driver and its bundled libmongoc library with FPM on Linux and OS X systems. The issue stemmed from libmongoc's shutdown function being invoked before the driver could unregister its memory allocation functions (typically those for Zend's memory manager). As a result, libmongoc might free certain resources with the wrong function and trigger a segfault.
Those running the driver without libmongoc bundled in (i.e. dynamically loading a system library) will need to wait for CDRIVER-1165 to be implemented and released upstream. For the time being, they may consider switching to a bundled build of the driver.
A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12484&version=16604
Documentation
Documentation is available on PHP.net:
http://php.net/set.mongodb
Feedback
We would appreciate any feedback you might have on the project:
https://jira.mongodb.org/secure/CreateIssue.jspa?pid=12484&issuetype=6
Installation
You can either download and install the source manually, or you can install the extension with:
pecl install mongodb
or update with:
pecl upgrade mongodb
Windows binaries are available on PECL:
http://pecl.php.net/package/mongodb
Thanks
Special thanks to Paul Buonopane for providing a thorough investigation of this issue in his bug report, which ultimately lead to the diagnosis and fix.
1.1.4
The PHP team is happy to announce that version 1.1.4 of our new mongodb PHP extension is now available on PECL.
Release Highlights
This release fixes a BSON encoding issue where 64-bit integer array keys would be truncated to 32-bit values. Additionally, the ObjectID constructor was improved to accept uppercase hexadecimal characters (it previously required lowercase strings).
A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12484&version=16582
Documentation
Documentation is available on PHP.net:
http://php.net/set.mongodb
Feedback
We would appreciate any feedback you might have on the project:
https://jira.mongodb.org/secure/CreateIssue.jspa?pid=12484&issuetype=6
Installation
You can either download and install the source manually, or you can install the extension with:
pecl install mongodb
or update with:
pecl upgrade mongodb
Windows binaries are available on PECL:
http://pecl.php.net/package/mongodb
1.1.3
The PHP team is happy to announce that version 1.1.3 of our new mongodb PHP extension is now available on PECL.
Release Highlights
This release fixes a segfault when decoding corrupt BSON and improves error reporting when attempting to convert invalid BSON to a PHP variable or JSON string.
When serializing root and embedded Persistable objects, the resulting BSON document will now always include the class name identifier field (i.e. __pclass
). Previously, the driver only included the field when serializing objects for insertion or via fromPHP()
. This change makes the driver compliant with the existing Persistence specification; however, it may break existing code that returned atomic modifiers from Peristable::bsonSerialize()
to use with an update query.
There are several fixes related to handling of 64-bit integers, including but not limited to UTCDateTime's constructor accepting a numeric string on 32-bit platforms and the encoding and decoding of 64-bit integers to and from BSON.
Server selection failures now throw a ConnectionTimeoutException instead of a generic RuntimeException. This affects executeBulkWrite()
, executeCommand()
, executeQuery()
, and selectServer()
, which are the four driver methods that may result in server selection and/or connection initialization.
The WriteException message, which was previously "BulkWrite error", now includes a concatenation of all write and write concern errors.
The "readconcernlevel" option is now parsed from the Manager constructor's options array. Previously, it was only parsed from the connection URI string.
The ObjectID constructor no longer aborts when constructed with a null value. Instead, a new ObjectID will be generated, which is the same behavior as if no argument had been passed.
This release also bumps our libmongoc and libbson dependencies to 1.3.3. Notably, this update adds support for negative cursor limits (CDRIVER-1054).
A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12484&version=16483
Documentation
Documentation is available on PHP.net:
http://php.net/set.mongodb
Feedback
We would appreciate any feedback you might have on the project:
https://jira.mongodb.org/secure/CreateIssue.jspa?pid=12484&issuetype=6
Installation
You can either download and install the source manually, or you can install the extension with:
pecl install mongodb
or update with:
pecl upgrade mongodb
Windows binaries are available on PECL:
http://pecl.php.net/package/mongodb
1.1.2
The PHP team is happy to announce that version 1.1.2 of our new mongodb PHP extension is now available on PECL.
Release Highlights
This release fixes a symbol collision that caused segfaults for some users who had both the new and legacy drivers (mongodb.so and mongo.so, respectively) loaded. Additionally, it resolves an issue with BSON encoding of variable references in PHP 7.
A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12484&version=16396
Documentation
Documentation is available on PHP.net:
http://php.net/set.mongodb
Feedback
We would appreciate any feedback you might have on the project:
https://jira.mongodb.org/secure/CreateIssue.jspa?pid=12484&issuetype=6
Installation
You can either download and install the source manually, or you can install the extension with:
pecl install mongodb
or update with:
pecl upgrade mongodb
Windows binaries are available on PECL:
http://pecl.php.net/package/mongodb
Thanks
Thanks for our community contributors for 1.1.2:
1.1.1
The PHP team is happy to announce that version 1.1.1 of our new mongodb PHP extension is now available on PECL. This release adds support for PHP 7, but is otherwise functionally equivalent to 1.1.0.
Release Highlights
A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12484&version=16390
Documentation
Documentation is available on PHP.net:
http://php.net/set.mongodb
Feedback
We would appreciate any feedback you might have on the project:
https://jira.mongodb.org/secure/CreateIssue.jspa?pid=12484&issuetype=6
Installation
You can either download and install the source manually, or you can install the extension with:
pecl install mongodb
or update with:
pecl upgrade mongodb
Windows binaries are available on PECL:
http://pecl.php.net/package/mongodb
Thanks
Thanks for our community contributors for 1.1.1:
1.1.0
The PHP team is happy to announce that version 1.1.0 of our new mongodb PHP extension is now available on PECL. This release adds support for new features in MongoDB 3.2.
Release Highlights
MongoDB\Driver\BulkWrite
now supports a bypassDocumentValidation
option, which may be used to control how document validation is enforced for insert and update operations. For more information on this feature, see Document Validation in the MongoDB 3.2 release notes.
A new MongoDB\Driver\ReadConcern
class has also been introduced, instances of which may be passed as a readConcern
option to MongoDB\Driver\Query
to control the isolation level of queries. For more information on this feature, see Read Concern in the MongoDB 3.2 release notes.
This release also bumps our libmongoc and libbson dependencies to 1.3.0.
A complete list of resolved issues in this release may be found at:
https://github.com/mongodb/mongo-php-driver/blob/master/RELEASE-1.1
Documentation
Documentation is available on PHP.net:
http://php.net/set.mongodb
Feedback
We would appreciate any feedback you might have on the project:
https://jira.mongodb.org/secure/CreateIssue.jspa?pid=12484&issuetype=6
Installation
You can either download and install the source manually, or you can install the extension with:
pecl install mongodb
or update with:
pecl upgrade mongodb
Windows binaries are available on PECL:
http://pecl.php.net/package/mongodb
Thanks
Thanks for our community contributors for 1.1.0:
- Jorgen Evens
1.0.1
This is the first bug fix release of the 1.0 series of the MongoDB PHP Driver.
Release Highlights
This release fixes a logical issue in the check_closed stream handler, which may have previously reported an open stream as closed and thrown an exception.
A complete list of resolved issues in this release may be found at:
https://github.com/mongodb-labs/mongo-php-driver-prototype/blob/v1.0/RELEASE-1.0
Documentation
Documentation is available on PHP.net:
http://php.net/set.mongodb
Feedback
We would appreciate any feedback you might have on the project:
https://jira.mongodb.org/secure/CreateIssue.jspa?pid=12484&issuetype=6
Installation
You can either download and install the source manually, or you can install the extension with:
pecl install mongodb
or update with:
pecl upgrade mongodb
Windows binaries are available on PECL:
http://pecl.php.net/package/mongodb
1.0.0
The PHP team is delighted to announce that version 1.0.0 of our new mongodb PHP extension is now available on PECL. This stable 1.0.0 release is the culmination of more than one year of active development and represents a substantial evolution in the PHP driver's architecture.
Introduction
This extension is written atop libmongoc and libbson, and purposefully offers a basic API for core functionality (e.g. connection handling, queries, commands, write operations, and BSON serialization). Additional functionality is left to be implemented by userland libraries, such as our mongo-php-library. Our hope is that this separation of concerns will keep the driver lightweight (and fast), easier to maintain, and make it an ideal starting point for constructing your own framework or library. If you are building an application with MongoDB, we would suggest that you use this driver in conjunction with the higher-level mongo-php-library.
For a more detailed explanation of our new architecture, see the following article on the MongoDB blog, which was published earlier this year:
https://www.mongodb.com/blog/post/call-feedback-new-php-and-hhvm-drivers
Compatibility
This initial release provides compatibility with MongoDB 2.4 through 3.0 and PHP 5.4 through 5.6 (PHP 7 is scheduled for 1.1.0). Support for Facebook's HHVM runtime will be provided by mongo-hhvm-driver, which implements the same public API found in this extension. A common API means that mongo-php-library is compatible with both this extension and its HHVM counterpart.
This driver implements several new MongoDB driver specifications, such as Server Discover and Monitoring and Server Selection. Higher-level specifications, such as our CRUD API, are implemented in mongo-php-library.
Improvements
- More concise API (e.g. command helpers are now left to userland libraries)
- Direct access to individual server connections
- Compatibility with cross-driver specifications
- Richer BSON handling (e.g. extended JSON, ODM functionality)
BSON handling has improved considerably from our legacy driver. Users now have much more control over how BSON arrays and documents are unserialized into PHP values (e.g. PHP arrays, stdClass objects, or custom classes via built-in ODM functionality). This eliminates a significant shortcoming of the legacy driver, where PHP arrays were used exclusively.
More information on these BSON improvements may be found in the following documentation:
Overview
The 1.0.0 release implements a brand new API and is a significant departure from our legacy driver. The new driver provides several new core classes:
- MongoDB\Driver\Manager (the client, which encapsulates one or more Servers)
- MongoDB\Driver\Server (represents a single connection)
- MongoDB\Driver\Cursor (result of an executed command or query)
- MongoDB\Driver\BulkWrite (mutable object for a batch of write operations)
Additionally, there are several new value objects:
- MongoDB\Driver\Command (command document)
- MongoDB\Driver\Query (query and options)
- MongoDB\Driver\CursorId (64-bit cursor ID)
- MongoDB\Driver\ReadPreference
- MongoDB\Driver\WriteConcern
- MongoDB\Driver\WriteResult (result of a bulk write operation)
- MongoDB\Driver\WriteConcernError
- MongoDB\Driver\WriteError (bulk write operations may yield multiple errors)
BSON interfaces and classes may be found under the MongoDB\BSON namespace.
Queries, commands, and write operations may be executed via the following methods on the MongoDB\Driver\Manager class:
These methods also exist on the MongoDB\Driver\Server class, for lower-level control over exactly which server handles the operation.
Changes from our legacy mongo extension
Most significantly, the legacy driver's MongoClient, MongoDB, and MongoCollection classes have been obsoleted by the MongoDB\Driver\Manager class, which is the new gateway for connecting and executing queries, commands, and write operations.
Two significant behavioral changes between the legacy and new driver are:
- Unlike MongoCursor in the legacy driver, which had pre- and post-executed states and could be rewound to re-execute a query, MongoDB\Driver\Cursor always corresponds to results of an executed command or query and may only be iterated once.
- The new driver unserializes BSON documents (both root and embedded) as stdClass objects by default (compared to PHP arrays in the legacy driver). This behavior may be customized via the
setTypeMap()
method on MongoDB\Driver\Cursor and is discussed in more detail in the BSON persistence documentation.
Note: mongo-php-library does provide client, database, and collection classes, which resemble the like-named classes in our legacy driver; however, while these new classes are mostly equivalent, some command helper methods have not been reimplemented and public APIs in the library have changed to ensure compatibility with current specifications such as the CRUD API.
What is the status of the legacy mongo extension?
The mongodb extension supersedes our legacy mongo extension.
We plan to continue supporting our existing mongo driver with critical bug fixes and maintenance releases; however, it will no longer be actively developed with new functionality (e.g. support for HHVM, PHP 7, or MongoDB 3.2).
Roadmap
We expect to add support for PHP 7 and MongoDB 3.2 in forthcoming 1.1.0 and 1.2.0 releases, respectively. Future development may be tracked in our public PHPC JIRA project.
In the more immediate future, you can expect 1.0.0 releases of mongo-hhvm-driver (currently available in as 1.0.0RC1) and mongo-php-library (currently 1.0.0-beta1), which are tracked in our HHVM and PHPLIB JIRA projects, respectively.
GridFS will be implemented entirely in our userland API and is planned for mongo-php-library 1.1.0.
Documentation
Documentation for this extension is available on PHP.net:
http://php.net/set.mongodb
Additionally, the GitHub repository contains additional documentation on common use cases, such as executing queries, commands, and write operations:
http://mongodb.github.io/mongo-php-driver/
Feedback
We would appreciate any feedback you might have on the project:
https://jira.mongodb.org/secure/CreateIssue.jspa?pid=12484&issuetype=6
Installation
The extension may be installed via PECL:
pecl install mongodb
If you've previously installed the extension, you may update it with:
pecl upgrade mongodb
Windows binaries are also available on PECL:
http://pecl.php.net/package/mongodb
🐘 Thanks
Thanks for everyone who contributed along the way to 1.0.0:
- Remi Collet
- Hannes Van De Vreken
- serebro
- Daniel Kozak
- Christian Amor Kvalheim
Cheers,
Hannes Magnusson, Derick Rethans, and Jeremy Mikola
1.0.0RC0
The PHP team is happy to announce that version 1.0.0-RC0 of our new "mongodb" PHP extension is now available on PECL.
Release Highlights
In this release, we have changed a few APIs. The MongoDB\Driver\Manager
methods for single writes have been removed (i.e. executeInsert()
, executeDelete()
, and executeUpdate()
). Instead, executeBulkWrite()
must be used for all write operations. Note that the PHP library provides methods for single write operations through its MongoDB\Collection
class.
Additionally, we have removed WriteResult::getInfo()
and the DuplicateKeyException, WriteConcernException, and WriteErrorException classes. We have also tidied up some use of the "final" keyword and updated our bundled libmongoc and libbson libraries to version 1.2.0.
A complete list of resolved issues in this release may be found at:
https://github.com/mongodb-labs/mongo-php-driver-prototype/blob/master/RELEASE-1.0
Documentation
Documentation is available on PHP.net:
http://php.net/set.mongodb
Feedback
We would appreciate any feedback you might have on the project:
https://jira.mongodb.org/secure/CreateIssue.jspa?pid=12484&issuetype=6
Installation
You can either download and install the source manually, or you can install the extension with:
pecl install mongodb-beta
or update with:
pecl upgrade mongodb-beta
Windows binaries are available on PECL:
http://pecl.php.net/package/mongodb
1.0.0beta2
The PHP team is happy to announce that version 1.0.0-beta2 of our new "mongodb" PHP extension is now available on PECL.
Release Highlights
As of this release, protected and private properties of objects are ignored when serializing the object to a BSON document. If non-public properties of a class must be serialized, users should consider implementing the MongoDB\BSON\Serializable
or MongoDB\BSON\Persistable
interface.
The Manager::getWriteConcern()
and Manager::getReadPreference()
methods now return WriteConcern and ReadPreference value objects instead of arrays describing the write concern or read preference, respectively. Additionally, getter methods (e.g. getTagSets()
) have been added to both classes. The deprecated fsync
option has been removed from WriteConcern.
This release bumps our libmongoc dependency to 1.2.0-rc0. Our libbson dependency has also been bumped to 1.2.0-rc0.
A complete list of resolved issues in these releases may be found at:
https://github.com/mongodb-labs/mongo-php-driver-prototype/blob/master/RELEASE-1.0
Documentation
Documentation is available on PHP.net:
http://php.net/set.mongodb
Feedback
As the "mongodb" extension is under heavy development, we would appreciate any feedback you might have on the project:
https://jira.mongodb.org/secure/CreateIssue.jspa?pid=12484&issuetype=6
Installation
You can either download and install the source manually, or you can install the extension with:
pecl install mongodb-beta
or update with:
pecl upgrade mongodb-beta
Windows binaries are available on PECL:
http://pecl.php.net/package/mongodb