1.4.3 - Jul 16, 2019

The PHP team is happy to announce that version 1.4.3 of the MongoDB PHP library is now available. This library is a high-level abstraction for the mongodb extension.

Release Highlights

This release addresses two bugs related to resuming a change stream during its iteration. The iteration key reported by the change stream is now properly incremented for an iteration event that resumes. Additionally, the resume token is now correctly updated on consecutive resume attempts.

A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=23304

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

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

1.4.2 - Jul 30, 2018

The PHP team is happy to announce that version 1.4.2 of the MongoDB PHP library is now available. This library is a high-level abstraction for the mongodb extension.

Release Highlights

This releases addresses a bug where MongoDB\Collection::countDocuments() would throw an exception if no documents are found. Some tests were improved too.

A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=21113

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

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

1.4.1 - Jul 10, 2018

The PHP team is happy to announce that version 1.4.1 of the MongoDB PHP library is now available. This library is a high-level abstraction for the mongodb extension.

Release Highlights

This release contains a fix for cloning MongoDB\Model\BSONArray and MongoDB\Model\BSONDocument objects that contain uncloneable PHP objects.

A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=20988

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

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

1.4.0 - Jun 27, 2018

The PHP team is happy to announce that version 1.4.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.0 and drops support for MongoDB 2.6 and earlier.

Release Highlights

MongoDB 4.0 introduces support for cluster-level and database-level change streams, which may be created via the new MongoDB\Client::watch() and MongoDB\Database::watch() methods, respectively. All change streams now support a startAtOperationTime option, which can be used to specify an exact point in time for the change stream to begin. Additionally, the internal logic for resuming change streams after encountering an error has been improved.

New MongoDB\Collection::countDocuments() and MongoDB\Collection::estimatedDocumentCount() methods have been introduced. countDocuments() may be executed within a transaction and should be preferred where an exact document count is required. estimatedDocumentCount() cannot be executed within a transaction but may otherwise be used when an approximate, non-filtered count is acceptable. The MongoDB\Collection::count() has been deprecated (in documentation only) due to its incompatibility with transactions and inaccuracy in sharded clusters. Users should note that countDocuments() uses an aggregation pipeline instead of the count command, so it does not support $where, $near, and $nearSphere query operators accepted in a count() filter (alternative syntax is discussed in the countDocuments() documentation).

A MongoDB\Collection::explain() method has been introduced as a helper for the explain command, which may be used to explain operations such as find, findAndModify, update, and others. MongoDB\Collection::aggregate() now also supports an explain option (note: the server's API for explaining aggregate differs from other commands).

Several usability improvements were made for the library's model classes for database, collection, and index information. Additionally, a MongoDB\Database::modifyCollection() method has been introduced as a wrapper for the collMod command.

This release upgrades the mongodb extension requirement to 1.5.0. Support for MongoDB 2.6 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=19898

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

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

1.3.2 - Apr 19, 2018

The PHP team is happy to announce that version 1.3.2 of the MongoDB PHP library is now available. This library is a high-level abstraction for the mongodb extension.

Release Highlights

This release contains fixes for session consistency in change streams and executing findAndModify commands when a client-level read concern has been specified.

A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=20437

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

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

1.3.1 - Mar 27, 2018

The PHP team is happy to announce that version 1.3.1 of the MongoDB PHP library is now available. This library is a high-level abstraction for the mongodb extension.

Release Highlights

This release contains fixes for key incrementing in ChangeStream::next() and resume functionality in ChangeStream::rewind(). Additionally, it includes a performance improvement for seeking forward in GridFS files.

A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=19818

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

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

Thanks

Thanks for our community contributors for this release:

    Maxime Alves

1.3.0 - Feb 9, 2018

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:

    Gabriel Caruso
    Mickaël Lao-Pane

1.2.0 - Oct 30, 2017

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:

    Katherine Walker
    Petr Buchin
    Fabien Villepinte
    Andreas Braun

1.2.0-alpha1 - Mar 16, 2017

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 - Feb 16, 2017

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

@jmikola jmikola released this Feb 16, 2017 · 953 commits to master since this release

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 - Jan 18, 2017

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 - Dec 6, 2016

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:

    Will Banfield
    Jonas Licht
    Jonathan Hawk
    Dmitry
    Metod
    Allison Reinheimer Moore
    Alessandro Galli
    Andreas Braun
    Fabien Villepinte
    Guido Sangiovanni
    Antoine Bellion

1.0.4 - Dec 5, 2016

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 - Sep 29, 2016

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 by filename (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 by filename (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. A filename is required and you may optionally provide: _id (defaults to a new MongoDB\BSON\ObjectID), metadata (analogous to custom fs.files fields in the legacy driver), and chunkSizeBytes (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 a filename and the same options as openUploadStream()) 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:

    Will Banfield
    Jonas Licht
    Jonathan Hawk
    Dmitry
    Metod
    Allison Reinheimer Moore
    Alessandro Galli
    Andreas Braun
    Fabien Villepinte
    Guido Sangiovanni
    Antoine Bellion

1.0.3 - Sep 23, 2016

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:

    Dmitry
    Jesper Wallin

1.0.2 - Mar 30, 2016

The PHP team is happy to announce that version 1.0.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 maintenance release includes a bug fix pertaining to the handling of options for the Find operation.

A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=16629

Documentation

Documentation for this library may be found at:
http://mongodb.github.io/mongo-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:

    Nick Dresselhaus

1.0.1 - Mar 4, 2016

The PHP team is happy to announce that version 1.0.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 maintenance release includes two bugs fixes pertaining to the handling of options for the Find and Aggregate operations.

A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=16537

Documentation

Documentation for this library may be found at:
http://mongodb.github.io/mongo-php-library/

Generated API reference for this library may be found at:
http://mongodb.github.io/mongo-php-library/api/

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 1.0.1:

    Andreas Braun
    minenok-tutu

1.0.0 - Jan 25, 2016

The PHP team is happy to announce that version 1.0.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).

Release Highlights

This library provides Client, Database, and Collection classes, each of which contains helper methods for their context. For instance, the Client class may be constructed with a MongoDB connection URI and serve as the gateway for selecting Database and Collection classes; the Database class may be used to create and drop collections or execute arbitrary commands; the Collection class contains a suite of CRUD operations and index management methods. These classes are analogous to the MongoClient, MongoDB, and MongoCollection classes found in the legacy mongo extension; however, the APIs are not identical.

This library implements the following MongoDB cross-driver specifications:

    CRUD
    Index Management
    Index Enumeration
    Collection Enumeration

Starting with version 1.0.0 of the library, BSON documents and arrays are unserialized as MongoDB\Model\BSONDocument and MongoDB\Model\BSONArray classes by default (this may be customized via the typeMap option on any of the core classes). These model classes implement the MongoDB\BSON\Serializable and MongoDB\BSON\Unserializable interfaces found in the new driver, which the library uses to ensure that each class is properly serialized back to its original BSON type. This eliminates a caveat of the legacy driver where BSON arrays might turn into objects, and vice versa. Additionally, the new model classes extend PHP's ArrayObject class for usability (e.g. documents and arrays support element access via [] and the document class may also use ->).

A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=15987

Documentation

Documentation for this library may be found at:
http://mongodb.github.io/mongo-php-library/

Generated API reference for this library may be found at:
http://mongodb.github.io/mongo-php-library/api/

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"

The MongoDB PHP driver may be installed or upgraded with:

pecl install mongodb
pecl upgrade mongodb

Installation Instructions for the HHVM driver may be found in the PHP.net documentation.

1.0.0-beta2 - Dec 28, 2015

The PHP team is happy to announce that version 1.0.0-beta2 of our MongoDB PHP library, which abstracts our PHP and HHVM extensions, is now available. This release adds support for new features in MongoDB 3.2 and introduces a new option to control BSON unserialization throughout the library.

Release Highlights

The core Database and Collection classes are now constructed with options arrays instead of nullable WriteConcern and ReadPreference parameters. The new typeMap and readConcern options may now be passed in via these arrays. Additionally, both classes now have a withOptions() method to allow users to create a cloned instance with different options (e.g. changing the default read preference for a Collection).

A new Database::command() method was added to allow users to execute arbitrary database commands for which the library may not already provide a helper.

The new typeMap option, which was introduced to the Client, Database, and Collection classes, allows users to provide a default type map to be applied to cursors returned by the library. This option is inherited from parent contexts (i.e. a Client's type map will be inherited by selected Database and Collection objects). Users looking to emulate the legacy driver's behavior of returning both BSON documents and arrays as PHP arrays may use the following type map:

$client = new MongoDB\Client($uri, [], ['typeMap' => ['root' => 'array', 'document' => 'array']]);

The above behavior is not recommended due to ambiguities between associative and numerically indexed PHP arrays, which is why we abandoned this legacy behavior in the new driver. For our upcoming 1.0.0 stable release, we hope to provide user-friendly classes for BSON documents and arrays to use in the library's default type map. These classes will implement PHP's ArrayAccess interface (addressing concerns some users have working with stdClass instances) while still ensuring that documents and arrays are correctly serialized to BSON (using object-casting and array_values(), respectively). Progress for that task is being tracked in PHPLIB-74.

This release also has several internal improvements for compatibility with version 1.1.1 of the PHP "mongodb" extension, which added support for PHP 7.

A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=16400

Documentation

Documentation for this library (and its API) may be found at:
http://mongodb.github.io/mongo-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@beta"

The MongoDB PHP driver may be installed or upgraded with:

pecl install mongodb

Installation Instructions for the HHVM driver may be found in that project's README.

Thanks

Thanks for our community contributors for this release:

    Anton Tuyakhov
    Remi Collet

1.0.0-beta1 - Nov 2, 2015

The PHP team is happy to announce that version 1.0.0-beta1 of our MongoDB PHP library, which abstracts our PHP and HHVM extensions, is now available.
Release Highlights

This release has several internal improvements for compatibility with versions 1.0.0 and 1.0.0RC1 of the PHP and HHVM "mongodb" extensions (i.e. drivers), respectively.

Additionally, the findOne() method now accepts a typeMap option to allow more control over how the returned document is unserialized from BSON (as was already possible with find() by calling MongoDB\Driver\Cursor::setTypeMap()).

A complete list of resolved issues in this release may be found at:
https://github.com/mongodb/mongo-php-library/blob/master/RELEASE-1.0
Documentation

Documentation for this library (and its API) may be found at:
http://mongodb.github.io/mongo-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@beta"

The MongoDB PHP driver may be installed or upgraded with:

pecl install mongodb

Installation Instructions for the HHVM driver may be found in that project's README.

1.0.0-alpha1 - Oct 7, 2015

The PHP team is happy to announce that version 1.0.0-alpha1 of our MongoDB PHP library, which abstracts our PHP and HHVM extensions, is now available.
Release Highlights

This release has several internal improvements for compatibility with versions 1.0.0-beta2 and 1.0.0-alpha1 of the PHP and HHVM "mongodb" extensions (i.e. drivers), respectively. Additionally, many of the database and collection methods have been refactored to use self-contained operation classes.

A complete list of resolved issues in this release may be found at:
https://github.com/mongodb/mongo-php-library/blob/master/RELEASE-1.0
Documentation

Documentation for this library (and its API) may be found at:
http://mongodb.github.io/mongo-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@alpha"

The MongoDB PHP driver may be installed or upgraded with:

pecl install mongodb-beta

Installation Instructions for the HHVM driver may be found in that project's README.

0.2.0 - May 12, 2015

MongoDB PHP Library 0.2.0 released

This is the second alpha release for the MongoDB PHP library. This release introduces Client and Database classes and adds full support for the CRUD and collection/index management specifications. Additionally, the library should be compatible with all versions of MongoDB going back to 2.4. The library's dependency on the MongoDB PHP driver (i.e. extension) has also been bumped to 0.6.

This library may be installed or upgraded with:

composer require "mongodb/mongodb=^0.2.0"

The MongoDB PHP driver may be installed or upgraded with:

pecl install mongodb-alpha

A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?version=14845&projectId=12483

Documentation for this library (and its API) may be found at:
http://10gen-labs.github.io/mongo-php-library-prototype/

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

0.1.0 - Dec 12, 2014

Woot! Initial PHongo library released !

This is the initial release of PHongo CRUD (being renamed to PHongo Library).

PHongo CRUD is an CRUD API ontop of Phongo. Its purpose is to provide standard MongoDB API and follows the MongoDB CRUD API Specification[1] that all MongoDB supported drivers follow.

PHongo CRUD provides several convenience methods that abstract the core PHongo extension. The methods include functionality to insert a single document, counting all documents in an collection, and delete documents from a collection.

Checkout the initial documentations at: http://bjori.github.io/phongo-crud/
And API docs at: http://bjori.github.io/phongo-crud/api/class-MongoDB.Collection.html

Let us know what you think!

[1] The specification has not been published yet - it is still a Work In Progress
