Navigation
  • Release Notes >
  • Release Notes for MongoDB 3.6 (Release Candidate)

Release Notes for MongoDB 3.6 (Release Candidate)

MongoDB 3.6 is currently in development.

Warning

While 3.6 release candidates are available, these versions of MongoDB are for testing purposes only and not for production use.

Security

Default Bind to Localhost

Starting in MongoDB 3.6, MongoDB binaries, mongod and mongos, bind to localhost by default. Previously, starting in MongoDB 2.6, only the binaries from the official MongoDB RPM (Red Hat, CentOS, Fedora Linux, and derivatives) and DEB (Debian, Ubuntu, and derivatives) packages bind to localhost by default. For more details, see Localhost Binding Compatibility Changes.

Additional Security Enhancements

Aggregation

The following features are available starting in MongoDB 3.6.

More Expressive $lookup

$lookup adds support for specifying multiple join conditions as well as uncorrelated sub-queries by allowing variable specification and pipeline execution on the joined collection.

For details, see the $lookup syntax for Join Conditions and Uncorrelated Sub-queries.

New Aggregation Stages

MongoDB 3.6 adds the following new aggregation pipeline stages:

Operator Description
$listSessions Lists sessions in the system.sessions collection in the config database.
$listLocalSessions Lists sessions cached in memory by the server.
$currentOp Returns a stream of documents containing information on active and/or dormant operations on a mongod instance.

New Aggregation Operators

Operator Description
$arrayToObject Converts an array of key value pairs to a document.
$objectToArray Converts a document to an array of documents representing key-value pairs.
$mergeObjects Combines multiple documents into a single document.
$dateFromString Converts a date/time string to a date object.
$dateFromParts Constructs a BSON Date object given the date’s constituent parts.
$dateToParts Returns a document containing the constituent parts of a date.

New Aggregation Helper

MongoDB 3.6 adds a helper, db.aggregate(), to perform aggregations that do not rely on an underlying collection, such as those that start with $currentOp or $listLocalSessions.

New Aggregation Variable

REMOVE allows for the conditional exclusion of a field.

New Options

aggregate command and the db.collection.aggregate() method support the following new options:

  • hint option to specify the index to use.

    Note

    The hint does not apply to $lookup and $graphLookup stages.

  • comment option to help trace the operation through the database profiler, currentOp, and logs.

Support for Time Zones

MongoDB 3.6 adds support for time zones to aggregation date operators.

Array Update Operator Enhancements

arrayFilters

The following commands and methods can accept an arrayFilters parameter to specify which elements to modify in an array field:

Commands Methods
findAndModify
update
 
Bulk.find.arrayFilters() for Bulk() operation methods updateOne() and update().

Multi-Element Array Updates

MongoDB 3.6 adds the following new positional operators for update operations on arrays and nested arrays:

  • The all positional $[] operator updates all elements in an array.
  • The filtered positional $[<identifier>] operator updates all elements in an array that match the arrayFilters criteria.

Negative Array Index Position for push

The $position modifier for the push update operator can accept a negative array index value to indicate a position starting from the end of the array.

Sessions

To provide causal consistency, MongoDB 3.6 enables causal consistency in sessions. A causally consistent session denotes that the associated sequence of read and acknowledged write operations have a causal relationship that is reflected by their ordering. Client applications must ensure that only one thread at a time executes these operations in a session.

Clients can start a session and associate operations with a specific session. Client applications must ensure that only one thread at a time executes these operations in a session.

Important

To use sessions, featureCompatibilityVersion must be set to “3.6”. For more information, see View FeatureCompatibilityVersion and setFeatureCompatibilityVersion.

Sessions Commands

The following session commands are available:

Commands Descriptions
endSessions Expire specified sessions.
killAllSessions Kill all sessions.
killAllSessionsByPattern Kill all sessions that match the specified pattern.
killSessions Kill specified sessions.
refreshSessions Refresh idle sessions.
startSession Starts a new session.

mongo Shell Changes

MongoDB 3.6 adds the new command-line option --retryWrites to the mongo shell. The option enables retryable writes as the default for sessions in the mongo shell.

The following new methods have been added to the Mongo() connection object in the mongo shell:

Aggregation Stages

To support sessions, MongoDB 3.6 adds the following new aggregation pipeline stages:

Operator Description
$listSessions Lists sessions in the system.sessions collection in the config database.
$listLocalSessions Lists sessions cached in memory by the server.

Command Options

The following options are available for all commands:

Option Type Description
lsid Document

The document that specifies the unique id of the session associated with the command. If the txnNumber is specified, the lsid is required.

Tip

The mongo shell and the drivers provide helpers to start the session and assign the lsid for the commands in the session.

txnNumber 64-bit integer

A strictly increasing non-negative number that uniquely identifies the command in the command’s session.

If specified, the command must also include the lsid option.

Tip

The mongo shell and the drivers provide helpers to start the session and assign a txnNumber to the commands in the session.

For the delete, insert, and update commands that take an array of statements, the following option is also available:

Option Type Description
stmtIds Array of 32-bit integers

Array of numbers that uniquely identifies their respective write operations within the write command.

Important

Do not manually set the stmtIds. MongoDB sets the stmtIds to strictly increasing non-negative number.

Parameters

The following new parameters are available for sessions:

JSON Schema

MongoDB 3.6 adds the $jsonSchema operator to support document validation using JSON Schema. For details, see $jsonSchema.

To use $jsonSchema, featureCompatibilityVersion must be set to “3.6”.

Replica Sets

  • Deprecate replica set protocol version 0 (pv0). For more information on the replica set protocol versions, see Replica Set Protocol Versions.
  • Added the replSetResizeOplog command to dynamically resize a replica set member’s oplog. Available for instances running the WiredTiger storage engine.
  • Added the catchUpTakeoverDelayMillis configuration option, dictating the amount of time a node waits to run for election after determining that it is ahead of the current primary.
  • For replica sets that use the protocol version 1 (pv1), arbiters will vote no in elections if they detect a healthy primary of equal or greater priority to the candidate. For more information on replica set protocol versions, see Replica Set Protocol Versions.
  • Added the oplogInitialFindMaxSeconds parameter to adjust how long a member of a replica set should wait for its find command to finish during data synchronization.

Sharded Clusters

General Enhancements

Collection Identifier

Collections have an immutable unique identifier.

New Operators

MongoDB 3.6 adds the following new query operators:

  • The new $jsonSchema operator matches documents that validate against the given JSON Schema. To use $jsonSchema, featureCompatibilityVersion must be set to “3.6”.
  • The $expr allows the use of aggregation expressions within the query language.

Removed Operators

MongoDB 3.6 removes the deprecated $pushAll update operator. For more information, see Remove $pushAll Update Operator.

Indexes

  • An index can cover a query on fields within nested documents.
  • Multikey indexes can cover queries over non-array keys if the index tracks which fields make it multikey.
  • When creating an index, you cannot specify * as the name of the index. See Indexes Named *.

Commands

  • Added the following options to the listDatabases admin command:
    • nameOnly to return only the database names (which does not require database locks) instead of returning both the database names and size information (which does require database locks).
    • filter to return databases that match the specified match criteria on the outputs.
  • Modified behavior of the validate command and the db.collection.validate() method such that only for full validation does the WiredTiger storage engine force a checkpoint, flush all in-memory data to disk, then verify the on-disk data. See also validate Operation.
  • The <database>.system.profile entry for update and delete contains the entire update/delete document applied to the named collection.
  • dropDatabase waits until all collections drops in the database have propagated to a majority of the replica set members.
  • For commands run on replica sets and sharded clusters, the response documents include the operationTime and $clusterTime. See db.runCommand and db.adminCommand.

Wire Protocol and Compression

  • MongoDB 3.6 introduces a new wire protocol opcode called OP_MSG. This opcode’s message format is extensible and designed to subsume the functionality of other opcodes.
  • Added support for the zlib compressor for --networkMessageCompressors option (or net.compression.compressors setting if using the configuration file). --networkMessageCompressors option (or net.compression.compressors setting) enables network compression for communication among mongod, mongos, mongo shell, and drivers that support the OP_COMPRESSED message format.
  • Enables snappy network compression for communication, by default, among mongod, mongos, and mongo shell.

Read Concern

"majority" read concern is always enabled and deprecates/obsoletes the use of --enableMajorityReadConcern and replication.enableMajorityReadConcern.

FTDC

MongoDB 3.6 adds support for Diagnostics Capture (also known as FTDC) in mongos. In previous versions, the feature is available for mongod only. See Diagnostic Parameters.

Note

FTDC is enabled by default.

Additional Enhancements

MongoDB 3.6 includes the following enhancements:

  • Added support for specifying full Unix domain socket paths with --bind_ip.
  • mongod now offers a --timeZoneInfo option. Use this option to specify the path to your system time zone database. The default configuration file included with Linux and macOS packages sets this to /usr/share/zoneinfo.
  • Date operations now accept consistent date ranges across all supported operating systems. You may safely work with years in the range 0 through 9999.
  • The new honorSystemUmask startup option for mongod causes new files created by MongoDB to have the read/write permissions specified by the umask of the user who runs the mongod process. Only available on Linux and macOS systems.
  • The maxWriteBatchSize limit of a database, which indicates the maximum number of write operations permitted in a write batch, raises from 1,000 to 100,000.

Changes Affecting Compatibility

Some changes can affect compatibility and may require user actions. For a detailed list of compatibility changes, see Compatibility Changes in MongoDB 3.6 Release Candidate.

Upgrade Procedures

Note

To upgrade, the 3.4 instances must have featureCompatibilityVersion set to 3.4. For more information, see View FeatureCompatibilityVersion and setFeatureCompatibilityVersion.

For upgrade instructions, see:

If you need guidance on upgrading to 3.6, MongoDB offers major version upgrade services to help ensure a smooth transition without interruption to your MongoDB application.

Download

To download the MongoDB 3.6 Release Candidate, go to the MongoDB Download Center

JIRA

To report an issue, see https://github.com/mongodb/mongo/wiki/Submit-Bug-Reports for instructions on how to file a JIRA ticket for the MongoDB server or one of the related projects.