Doctrine MongoDB ODM 1.2.0 and 1.1.7 Released post

Posted on 2017-10-24 by Andreas Braun


We are happy to announce the immediate availability of Doctrine MongoDB ODM 1.2.0 and 1.1.7.

MongoDB ODM 1.1.7

Notable fixes may be found in the changelog. A full list of issues and pull requests included in this release may be found in the 1.1.7 milestone.

What is new in 1.2.0?

Doctrine MongoDB ODM 1.2.0 introduces the following new features:

  • The readOnly mapping option allows you to map immutable documents.
  • With slaveOkay being deprecated, you can now specify a readPreference for your documents. This readPreference will automatically be applied to all queries for those mapped documents.
  • With dbRef only offering limited support in aggregation pipeline queries, there's a new reference storage strategy called ref that stores references as objects (without "\$"-prefixed field names), allowing you to use it with discriminators and aggregation pipeline queries.
  • When mapping inverse references, you may now specify fields that will be primed when the reference is resolved. This saves you from writing a dedicated repository method for the sole purpose of priming references.
  • The odm:schema:validate command validates the document mapping to help you spot mistakes.
  • A new builder for aggregation pipeline queries, including support for marshalling results into read-only documents.
  • Query result documents that can be used to hydrate results from an aggregation pipeline query. These documents cannot be written back to the database.

Upgrading to 1.2.0

The new version requires PHP 5.6. Running on PHP 7+ requires the use of a polyfill for the legacy driver, e.g. mongo-php-adapter. When running on PHP 5.6, MongoDB ODM requires version 1.6.7 or newer of the legacy MongoDB driver.

Several features have been deprecated in this release and will be dropped in the 2.0 release. To see this, please view the UPGRADE document.

Installation

You can install the new version of MongoDB ODM by using Composer and the following composer.json contents:

{
    "require": {
        "doctrine/mongodb-odm": "^1.2.0"
    }
}

Stability and upcoming releases

As of today, Doctrine MongoDB ODM 1.2.0 is the stable distribution. There is no release schedule for an upcoming version yet.

1.1.7 is the last release of the 1.1.x development line and will no longer receive bug fixes. Instead, we will focus on developing MongoDB ODM 2.0 with native support for the new MongoDB driver. This release will require at least PHP 7.1 and contain several BC breaking changes. To ease the migration process, we will release a 1.3.0 which will be backwards compatible to the 1.2.x line and only deprecate features to be removed in 2.0. The 1.x line of MongoDB ODM will not receive any new features.