Navigation
This is an upcoming (i.e. in progress) version of the manual.
  • Release Notes >
  • Release Notes for MongoDB 4.4 (Development Series 4.3.x)

Release Notes for MongoDB 4.4 (Development Series 4.3.x)

MongoDB 4.4 Dev Series (4.3.x) Available

MongoDB 4.4 is currently in development as part of the 4.3 development series. While the 4.3-dev-series are available, these versions of MongoDB are for testing purposes only and not for production use.

Aggregation

New Aggregation Operators

Operator Description
$binarySize Returns the size of a given string or binary data value’s content in bytes.
$bsonSize Returns the size in bytes of a given document (i.e. bsontype Object) when encoded as BSON.
$first Returns the first element in an array.
$last Returns the last element in an array.
$isNumber

Returns boolean true if the specified expression resolves to an integer, decimal, double, or long.

Returns boolean false if the expression resolves to any other BSON type, null, or a missing field

$replaceOne Replaces the first instance of a matched string in a given input.
$replaceAll Replaces all instances of a matched string in a given input.

General Aggregation Improvements

$indexStats

Starting in MongoDB 4.4 (also available starting in 4.2.4), $indexStats includes the following fields in its output:

Field Description
shard Name of the shard, if applicable.
spec Index specification document
building A boolean flag that indicates if the index is currently being built.

$merge

Starting in MongoDB 4.4, $merge can output to the same collection that is being aggregated. You can also output to a collection which appears in other stages of the pipeline, such as $lookup.

Versions of MongoDB prior to 4.4 did not allow $merge to output to the same collection as the collection being aggregated.

Warning

When $merge outputs to the same collection that is being aggregated, documents may get updated multiple times or the operation may result in an infinite loop. This behavior occurs when the update performed by $merge changes the physical location of documents stored on disk. When the physical location of a document changes, $merge may view it as an entirely new document, resulting in additional updates. For more information on this behavior, see Halloween Problem.

$planCacheStats Changes

Starting in version 4.4,

Background Validation

Starting in MongoDB 4.4, for the WiredTiger storage engine, you can run the validate command in the background or in the foreground. In earlier versions, you can only run validate in the foreground:

  • When run in background, the operation takes an intent shared lock on the collection and does not block reads and writes or DDL operations on the collection; however, the operation does not update collection count and size metrics.
  • When run in foreground, the operation takes an exclusive lock on the collection and blocks all reads and writes and DDL operations on the collection until the operation finishes. When run on a secondary, the operation can block all other operations on that secondary until it finishes.

For details, see the validate command and the db.collection.validate() helper.

Removed Commands

MongoDB removes the following command(s) and mongo shell helper(s):

Removed Command Removed Helper Alternatives
cloneCollection db.cloneCollection()
planCacheListPlans PlanCache.getPlansByQuery()
planCacheListQueryShapes PlanCache.listQueryShapes()

Networking

Support for TCP Fast Open

Starting with MongoDB 4.4, mongod and mongos support TCP Fast Open (TFO) connections by default. TFO requires both the client and the mongod/mongos host machines support and enable TFO:

Windows

The following Windows operating systems support TFO:

  • Microsoft Windows Server 2016 or later.
  • Microsoft Windows 10 Update 1607 or later.
macOS
macOS 10.11 (El Capitan) and later support TFO
Linux

Linux operating systems running Linux Kernel 3.7 or later can support inbound TFO connections.

Linux operating systems running Linux Kernel 4.11 or later can support both inbound and outbound TFO connections.

Set the value of /proc/sys/net/ipv4/tcp_fastopen to enable support for inbound and/or outbound TFO connections:

  • Set to 1 to enable only outbound TFO connections
  • Set to 2 to enable only inbound TFO connections
  • Set to 3 to enable inbound and outbound TFO connections.

MongoDB 4.4 adds the following parameters for controlling TFO:

Parameter Description
tcpFastOpenServer

Default: true (Enabled)

Enables or disables support for inbound TFO connections to the mongod/mongos

tcpFastOpenClient

Default: true (Enabled)

Linux Operating System Only

Enables or disables support for outbound TFO connections from the mongod/mongos.

tcpFastOpenQueueSize

Default: 1024

Control the size of the queue of pending TFO connections.

MongoDB 4.4 adds the following counters to the output of serverStatus and db.serverStatus():

Counter Description
network.tcpFastOpen.kernelSetting

Linux only

Indicates kernel support for TFO.

network.tcpFastOpen.serverSupported Indicates operating system support for incoming TFO connections.
network.tcpFastOpen.clientSupported Indicates operating system support for outgoing TFO connections.
network.tcpFastOpen.accepted Indicates the total number of accepted incoming TFO connections to the mongod/mongos since the mongod/mongos last started.

A complete discussion of TFO is outside the scope of this documentation. For more information on TFO, start with the following external resources:

Security Improvements

x.509 Certificates Nearing Expiry Trigger Warnings

Starting in MongoDB 4.4, mongod/mongos logs a warning on connection if the presented x.509 certificate expires within 30 days of the mongod/mongos system clock. Specifically, the following connections to a mongod or mongos can trigger x.509 certificate expiry warnings:

The warning log message resembles the following:

<Timestamp> W NETWORK [connection] Peer certificate <Certificate Subject Name> expires...

Consider proactively renewing client x.509 certificates nearing expiration to ensure continued connectivity to the cluster.

MongoDB 4.4 adds the tlsX509ExpirationWarningThresholdDays parameter for controlling certificate expiration warning threshold. Set the parameter to 0 to disable the warning. For complete documentation, see tlsX509ExpirationWarningThresholdDays.

Replica Sets

Rollback Directory

Starting in Mongo 4.4, the rollback directory for a collection is named after the collection’s UUID rather than the collection namespace; e.g.

<dbpath>/rollback/20f74796-d5ea-42f5-8c95-f79b39bad190/removed.2020-02-19T04-57-11.0.bson

For details, see Rollback Data.

General Improvements

Blocking Sort Limit Increased

If MongoDB cannot use an index or indexes to obtain the sort order for a given cursor.sort() operation, MongoDB must perform a blocking sort on the data. A blocking sort indicates that MongoDB must consume and process all input documents to the sort before returning results. Blocking sorts do not block concurrent operations on the collection or database.

Prior to MongoDB 4.4, MongoDB returned an error if a blocking sort operations required more than 32 megabytes of system memory. Starting in MongoDB 4.4, blocking sort operations increase the limit on system memory to use for the sort operation to 100 megabytes. For blocking sort operations which require more than 100 megabytes of system memory, MongoDB returns an error unless the query specifies cursor.allowDiskUse() (New in MongoDB 4.4).

For more information on sorting and index use, see Sort and Index Use.

allowDiskUse() Support for Queries with Large In-Memory Sorts

If MongoDB cannot use an index or indexes to obtain the sort order, MongoDB must perform a blocking sort operation on the data. A blocking sort indicates that MongoDB must consume and process all input documents to the sort before returning results. Blocking sorts do not block concurrent operations on the collection or database.

New in version 4.4.

If MongoDB requires using more than 100 megabytes of system memory for the blocking sort operation, MongoDB returns an error unless the query specifies cursor.allowDiskUse() (New in MongoDB 4.4). allowDiskUse() allows MongoDB to use temporary files on disk to store data exceeding the 100 megabyte system memory limit while processing a blocking sort operation. cursor.allowDiskUse() has no effect on sort operations resolved using an index or blocking sort operations which require less than 100 megabytes of system memory.

If using the find database command, specify the optional parameter allowDiskUse: true to allow MongoDB to use temporary files on disk to store data exceeding the 100 megabyte system memory limit while processing a blocking sort operation

For instructions on enabling allowDiskUse for queries issued through a MongoDB driver, defer to the documentation for your preferred MongoDB 4.4-compatible driver.

Collection Namespace Limit

Starting in MongoDB 4.4,

  • For featureCompatibilityVersion set to "4.4" or greater, MongoDB removes the 120 byte limit on collection/view namespace. For a collection or a view, the namespace includes the database name, the dot (.) separator, and the collection/view name (e.g. <database>.<collection>),
  • For featureCompatibilityVersion set to "4.2" or earlier, the maximum length of the collection/view namespace remains 120 bytes.

serverStatus Output Change

serverStatus returns flowControl.locksPerKiloOp instead of flowControl.locksPerOp.

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 4.4 (Development Series 4.3.x).

Upgrade Procedures

Feature Compatibility Version

To upgrade from 4.2 deployment, the 4.2 deployment must have featureCompatibilityVersion set to 4.2. To check the version:

db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )

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