Skip to content

Releases: mongodb/mongo-php-library

1.0.5

16 Feb 18:51
Compare
Choose a tag to compare

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

18 Jan 21:29
Compare
Choose a tag to compare

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

06 Dec 15:24
Compare
Choose a tag to compare

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

05 Dec 20:17
Compare
Choose a tag to compare

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

29 Sep 16:22
Compare
Choose a tag to compare
1.1.0-alpha1 Pre-release
Pre-release

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:

1.0.3

23 Sep 19:50
Compare
Choose a tag to compare

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:

1.0.2

30 Mar 19:11
Compare
Choose a tag to compare

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:

1.0.1

04 Mar 20:28
Compare
Choose a tag to compare

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:

1.0.0

25 Jan 15:27
Compare
Choose a tag to compare

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:

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

28 Dec 20:20
Compare
Choose a tag to compare
1.0.0-beta2 Pre-release
Pre-release

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: