Releases: mongodb/mongo-php-library
1.3.0
The PHP team is happy to announce that version 1.3.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 3.6 and drops support for MongoDB 2.4 and earlier.
Release Highlights
Version 1.4.0 of the mongodb
extension introduced a new MongoDB\Driver\Session
class to support client sessions for MongoDB 3.6. Session objects may be created via a new MongoDB\Client::startSession()
method. All Client, Database, and Collection methods that communicate with the server now accept a "session" option. Presently, this option may be used for facilitating causally consistent reads. Sessions are not currently supported for GridFS operations.
MongoDB 3.6 introduced change streams, which allows applications to subscribe to all data changes on a collection (without manually tailing the oplog). Change streams are implemented using the aggregation framework and tailable cursors. This release adds support for change streams via a new MongoDB\Collection::watch()
method, which returns a MongoDB\ChangeStream
iterator. This iterator wraps a MongoDB\Driver\Cursor
object and implements additional functionality, such as automatic resuming in the event of a dropped connection. A new tutorial on tailable cursor iteration has been added to the documentation, which is relevant for anyone working with tailable cursors or change streams.
Update methods (e.g. updateMany()
, findOneAndUpdate()
) now support an arrayFilters
option, which may be used to specify which elements to modify in an array field. See Specify arrayFilters for Array Update Operations in the MongoDB manual for more information on this new feature.
MongoDB\Client::listDatabases()
now supports a filter
option, which may be used to filter which databases are returned when connected to MongoDB 3.6.
This release upgrades the mongodb
extension requirement to 1.4.0. Support for MongoDB 2.4 and earlier has been removed.
A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=18790
Documentation
Documentation for this library may be found at:
https://docs.mongodb.com/php-library/
Installation
This library may be installed or upgraded with:
composer require mongodb/mongodb=^1.3.0
Installation instructions for the mongodb
extension may be found in the PHP.net documentation.
Thanks
Thanks for our community contributors for this release:
1.2.0
The PHP team is happy to announce that version 1.2.0 of the MongoDB PHP library is now available. This library is a high-level abstraction for the mongodb
extension.
Release Highlights
This release bumps the library's PHP requirement to 5.5 and mongodb
extension requirement to 1.3.
The Collection class now has a mapReduce()
command helper. The Collection find()
and findOne()
methods now support additional options, which brings them in sync with the extension's MongoDB\Driver\Query
class.
Core classes now have accessor methods for common options: read concern, read preference, type map, and write concern. Additionally, the GridFS Bucket class now has accessors for the chunkSizeBytes option and files and chunks collection objects.
GridFS streams now support seeking via fseek()
, which allows for partial file retrieval. Iterators returned by Database::listCollections()
and Collection::listIndexes()
can now be rewound and iterated multiple times.
Starting with this version, API changes such as new methods and options will be highlighted in the documentation.
A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=17734
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.2.0
Installation instructions for the mongodb
extension may be found in the PHP.net documentation.
Thanks
Thanks for our community contributors for this release:
1.2.0-alpha1
The PHP team is happy to announce that version 1.2.0-alpha1 of our MongoDB PHP library is now available. This library is a high-level abstraction for the PHP 5, PHP 7, and HHVM drivers (i.e. mongodb
extension).
Release Highlights
This release adds support for seeking and partial file retrieval of GridFS files (PHPLIB-213). This means that PHP's fseek()
and ftell()
functions can now be used on readable GridFS streams (e.g. resources returned by Bucket::openDownloadStream()
). Seeking is not supported for writable streams, which are append-only and always positioned at the end of the stream.
A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=18050
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.2.0-alpha1
Installation instructions for the PHP and HHVM driver may be found in the PHP.net documentation.
1.1.2
The PHP team is happy to announce that version 1.1.2 of our MongoDB PHP library is now available. This library is a high-level abstraction for the PHP 5, PHP 7, and HHVM drivers (i.e. mongodb
extension).
Release Highlights
This release removes duplicate server selection logic in MongoDB\Collection::findOne()
. For users with mixed server versions within the same replica set, this could result in the default read concern being passed to an unsupported server, which would trigger an error.
A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=17923
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.1.0
Installation instructions for the PHP and HHVM driver may be found in the PHP.net documentation.
1.0.5
The PHP team is happy to announce that version 1.0.5 of our MongoDB PHP library is now available. This library is a high-level abstraction for the PHP 5, PHP 7, and HHVM drivers (i.e. mongodb
extension).
Release Highlights
This release removes duplicate server selection logic in MongoDB\Collection::findOne()
. For users with mixed server versions within the same replica set, this could result in the default read concern being passed to an unsupported server, which would trigger an error.
A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=18001
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.0.0
Installation instructions for the PHP and HHVM driver may be found in the PHP.net documentation.
1.1.1
The PHP team is happy to announce that version 1.1.1 of our MongoDB PHP library is now available. This library is a high-level abstraction for the PHP 5, PHP 7, and HHVM drivers (i.e. mongodb
extension).
Release Highlights
This release resolves a number of issues related to GridFS.
If a GridFS upload is aborted due to an error, the library will now attempt to delete any previously uploaded chunks to avoid leaving orphan documents behind in the chunks collection. Also related to uploads, the reported file size of writable streams now includes buffered data that has not yet been inserted to a chunk document. Previously, only bytes that were inserted in chunk documents were considered.
Several improvements were made to fstat()
output for GridFS streams. Readable and writable streams now report their "mode" as 0100444
and 0100222
, respectively. Both types of streams now report their file document's "uploadDate" as "mtime" and "ctime". Additionally, the file's chunk size is now reported as "blksize".
Lastly, the readable and writable stream classes were refactored to buffer chunk data using PHP strings instead of php://memory
streams. While providing an immediate performance improvement, this change will also allow us to more easily support fseek()
for readable streams in the forthcoming 1.2.0 release (see: PHPLIB-213).
A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=17829
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.1.0
Installation instructions for the PHP and HHVM driver may be found in the PHP.net documentation.
1.1.0
The PHP team is happy to announce that version 1.1.0 of our MongoDB PHP library is now available. This library is a high-level abstraction for the PHP 5, PHP 7, and HHVM drivers (i.e. mongodb
extension). This release adds support for GridFS and new features in MongoDB 3.4.
Release Highlights
This release supports new features of MongoDB 3.4. Some operations now accept a "collation" document option, which can be used to specify a locale-aware string comparison or sort order. See Collation in the MongoDB manual for additional information. Additionally, operations that write to the database now accept a "writeConcern" option. Attempting to use either of these options when not supported by the server will yield an exception.
This release includes an implementation of the GridFS specification, which allows reading and writing of GridFS files using PHP's streams and filesystem functions. MongoDB\Database::selectGridFSBucket()
may be used to instantiate a MongoDB\GridFS\Bucket
object, which is analogous to MongoDB::getGridFS()
and the MongoGridFS
class in the legacy driver, respectively. The MongoDB\GridFS\Bucket
class is documented in the API reference and GridFS tutorial. Note that GridFS files do not currently support file seeking and random access, although that functionality is planned in PHPLIB-213.
A getManager()
accessor method has been added to the MongoDB\Client
, MongoDB\Database
, and MongoDB\Collection
classes, which may be used to retrieve the MongoDB\Driver\Manager
extension object. The MongoDB\Model\BSONDocument
and MongoDB\Model\BSONArray
classes now implement PHP's JsonSerializable
interface. This complements the driver's BSON types implementing the same interface in version 1.2.0 of extension.
The Collection's findOneAndDelete()
, findOneAndReplace()
, and findOneAndUpdate()
methods now support a configurable "typeMap" option and inherit the Collection's type map by default. While these methods were previously restricted to returning a generic PHP object in 1.0.0, they now return a MongoDB\Model\BSONDocument
by default. Additionally, aggregate()
now applies the "typeMap" option when executing an aggregate
command that does not return a cursor (e.g. server versions < 2.6).
A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=16207
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.1.0
Installation instructions for the PHP and HHVM driver may be found in the PHP.net documentation.
Thanks
Thanks for our community contributors for this release:
1.0.4
The PHP team is happy to announce that version 1.0.4 of our MongoDB PHP library is now available. This library is a high-level abstraction for the PHP 5, PHP 7, and HHVM drivers (i.e. mongodb
extension).
Release Highlights
This maintenance release includes a bug fix pertaining to applying a default "readConcern" option for Collection operations.
A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=17620
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.0.0"
Installation instructions for the PHP and HHVM driver may be found in the PHP.net documentation.
1.1.0-alpha1
The PHP team is happy to announce that version 1.1.0-alpha1 of our MongoDB PHP library is now available. This library is a high-level abstraction for the PHP 5, PHP 7, and HHVM drivers (i.e. mongodb
extension).
Release Highlights
This release includes an implementation of the GridFS specification, which allows reading and writing of GridFS files using PHP's streams and filesystem functions. MongoDB\Database::selectGridFSBucket()
may be used to instantiate a MongoDB\GridFS\Bucket
object, which is analogous to MongoDB::getGridFS()
and the MongoGridFS
class in the legacy driver, respectively.
MongoDB\GridFS\Bucket
provides the following methods for reading from GridFS files:
openDownloadStream()
: Selects a file by_id
and returns a readable stream.openDownloadStreamByName()
: Selects a file byfilename
(and optionally a revision) and returns a readable stream.downloadToStream()
: Selects a file by_id
and copies its contents to the destination stream.downloadToStreamByName()
: Selects a file byfilename
(and optionally a revision) and copies its contents to the destination stream.
MongoDB\GridFS\Bucket
provides the following methods for writing to GridFS files:
openUploadStream()
: Returns a writable stream for a new GridFS file. Afilename
is required and you may optionally provide:_id
(defaults to a newMongoDB\BSON\ObjectID
),metadata
(analogous to customfs.files
fields in the legacy driver), andchunkSizeBytes
(defaults to 261120). After writing to the stream, you must close it (e.g.fclose()
) to commit the file document to the GridFS collection.uploadFromStream()
: Creates a writable stream for a new GridFS file (given afilename
and the same options asopenUploadStream()
) and copies the contents of a readable stream to the new GridFS file. The_id
of the newly created GridFS file will be returned.
Additional utility and helper methods exist on the MongoDB\GridFS\Bucket
class, which you will find documented in the source. API reference and a GridFS tutorial will be added to the library documentation closer to the final 1.1.0 release.
A couple of other enhancements have also made it into this release. A getManager()
accessor method has been added to the MongoDB\Client
, MongoDB\Database
, and MongoDB\Collection
classes, which may be used to retrieve the MongoDB\Driver\Manager
extension object. The MongoDB\Model\BSONDocument
and MongoDB\Model\BSONArray
classes now implement PHP's JsonSerializable
interface. This will complement the driver's BSON types implementing the same interface in version 1.2.0 of extension (tracked in PHPC-459 and HHVM-158).
A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=17567
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.1.0-alpha1
Installation instructions for the PHP and HHVM driver may be found in the PHP.net documentation.
Thanks
Thanks for our community contributors for this release:
1.0.3
The PHP team is happy to announce that version 1.0.3 of our MongoDB PHP library is now available. This library is a high-level abstraction for the PHP 5, PHP 7, and HHVM drivers (i.e. mongodb
extension).
Release Highlights
This maintenance release includes a bug fix pertaining to the "writeConcern" option for FindAndModify operations (i.e. FindOneAndDelete, FindOneAndReplace, and FindOneAndUpdate).
A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=17533
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.0.0"
Installation instructions for the PHP and HHVM driver may be found in the PHP.net documentation.
Thanks
Thanks for our community contributors for this release: