Database Manual / Release Notes / 7.0

Compatibility Changes in MongoDB 7.0

This page describes changes introduced in MongoDB 7.0 that can affect compatibility with older versions of MongoDB.

MongoDB 7.0 is a Major Release, which means that it is supported for both MongoDB Atlas and on-premises deployments. MongoDB 7.0 includes changes introduced in MongoDB Rapid Releases 6.1, 6.2, and 6.3. This page describes compatibility changes introduced in those Rapid Releases and MongoDB 7.0.

To learn more about the differences between Major and Rapid Releases, see MongoDB Versioning.

For detail on downgrading from MongoDB 7.0, see Downgrade 7.0 to 6.0.

Deprecations

DeprecatedDescription

storageDetails

Deprecated in version 7.0.

taskExecutorPoolSize

Deprecated only for Linux in 7.0.

Free Monitoring Decommissioned

Starting in MongoDB 7.0, free monitoring is decommissioned. The following aren't available:

  • cloud.monitoring.free configuration option
  • --enableFreeMonitoring server parameter
  • db.enableFreeMonitoring() command
  • db.disableFreeMonitoring() command
  • setFreeMonitoring command

Queryable Encryption General Availability

Starting in MongoDB 7.0, Queryable Encryption with equality queries is generally available (GA). Improvements in the GA make it incompatible with the Queryable Encryption Public Preview, which should not be used now that the feature is GA.

Server and Drivers Compatibility Between Public Preview and GA

To use Queryable Encryption with equality queries, MongoDB server must be version 7.0 or later and drivers must be 7.0 compatible. If you are still using the Queryable Encryption Public Preview included with MongoDB 6.x, the server must remain on version 6.x and the drivers must be 6.x compatible. You cannot use MongoDB 6.x compatible drivers with a 7.0 server, or 7.0 compatible drivers with a 6.x server. Attempting to do so results in an error.

To make upgrading easier, MongoDB 7.0 drivers can decrypt data created with MongoDB 6.x drivers. For upgrade options, see the following sections.

Start Fresh (Preferred)

If possible, create new collections rather than migrating those produced with the Queryable Encryption Public Preview in MongoDB 6.x:

  1. Upgrade MongoDB server and drivers to 7.0.
  2. Configure a new encrypted collection with a different name from the previous collection.
  3. Insert new data, or an unencrypted version of the existing data if you have a local copy.
  4. Drop the previous version 6.x collection.

Migration

If you cannot use new data or do not have an unencrypted version of the existing data:

  1. Upgrade MongoDB server and drivers to 7.0
  2. Using a 7.0 compatible driver, query the encrypted collection to decrypt it.
  3. Save the output locally.
  4. Configure a new encrypted collection and ingest the data.

Warning

  • The mongoexport and mongodump operations do not decrypt the collection. You must query the collection from a driver to output the decrypted data.
  • MongoDB 7.0 compatible drivers can't query encrypted fields on data encrypted with MongoDB 6.x compatible drivers. To decrypt data, either query an unencrypted field or query the entire collection.

Backward-Incompatible Features

The following 7.0 features are not compatible with earlier versions of MongoDB. To downgrade from MongoDB 7.0 to an earlier version, you must remove data that uses any of the following features:

  • Collections with encryptedFields with range indexes
  • Compound wildcard indexes require FCV 7.0 or greater. A pre-7.0 mongod does not start if you are using one or more compound wildcard indexes.
  • Config servers that have collections with changeStreamPreAndPostImages enabled
  • Secondary TTL indexes with partial filters on time series collections
  • Time series collections with custom bucketing parameters

Intra-Node Authentication

Starting in MongoDB 7.0, you can configure servers to authenticate X.509 certificates as cluster members identified by attributes or extension values. You can also override this configuration to accept alternate certificates during a rolling upgrade.

To downgrade to MongoDB 6.0, perform the certificate rotation procedure to unset the net.tls.clusterAuthX509 setting and rotate the cluster membership certificates to ones with matching DC, O, and OU attributes.

Once this is complete, you can downgrade the cluster.

Time-Series

  • Remove partial TTL indexes from time series collections.
  • Remove or modify collections using new index parameters. In some cases, you may use collMod to switch to legacy granularity settings, if not you need to drop the collection before downgrading.

Cluster Configuration

Active setClusterParameter parameter operations prevent feature Compatibility Version (FCV) from successful completion.

Encrypted Multi-Map (EMM)

Remove collections that use the encryptedFields collection option before downgrading.

Wildcard Indexes

Compound wildcard indexes require FCV 7.0 or greater. A pre-7.0 mongod does not start if you are using one or more compound wildcard indexes.

OIDC Access Token Authentication Behavior

Starting in MongoDB 7.0, only one audience oidcIdentityProviders field can be specified for OIDC access tokens. audience fields with empty arrays or arrays of multiple strings are invalid.

For details, see oidcIdentityProviders Fields.

$natural Parameter Accepted Values

Prior to MongoDB 7.0, $natural accepts incorrect type values, such as 0, NaN, and -0.01. After MongoDB 7.0, if you pass any value other than 1 and -1 to $natural, MongoDB returns an error.

Changes Introduced in MongoDB 6.3

Granularity Settings

Starting in MongoDB 6.3, you can configure time series bucket granularity using the new bucketMaxSpanSeconds and bucketRoundingSeconds custom bucketing parameters. To downgrade below 6.3, you must either drop all collections with these parameters, or modify them to use the corresponding granularity. For details, see collMod.

Not all bucketMaxSpanSeconds and bucketRoundingSeconds values correspond to a granularity value. In such cases, you must drop the collection.

Partial TTL Indexes for Time Series Collections

Starting in MongoDB 6.3, you can create partial Time To Live (TTL) indexes on time series collections. To downgrade below 6.3, you must remove all partial TTL indexes from your time series collections.

Changes Introduced in MongoDB 6.2

config.settings Schema Validation

Starting in MongoDB 6.2, you must set value between 1 and 1024 (inclusive) when inserting or updating documents with the _id: chunksize field in the config.settings collection. If you specify an invalid value, MongoDB returns a schema validation error.

Any value fields outside the range of 1 to 1024 MB (inclusive) set prior to MongoDB 6.2 remain unchanged.

Removed Options

Starting in version 6.2, MongoDB removes the maxSize field from the addShard command. As a result:

  • Running addShard with the maxSize field returns an InvalidOptions error.
  • New documents in the shards collection no longer include the maxSize field.
  • Any pre-existing maxSize field entries are ignored.

Changes Introduced in MongoDB 6.1

$add Floating Point Rounding Errors

Starting in MongoDB 6.1, when an $add expression receives an input list with multiple floating point values, MongoDB may return slightly different results compared to previous versions.

The $add expression no longer accounts for floating-point rounding errors. As a result, $add behaves like addition in most programming languages.

For example, the following $add expression returns a different result when run on MongoDB 6.1 compared to older versions:

db.test.aggregate(
[
{
$project: {
sumOfValues: {
$add: [ 0.1, 0.2, 0.3 ]
}
}
}
]
)

MongoDB 6.1 and later output:

[
{
_id: ObjectId("6390f8085425651d8d0ef0a7"),
sumOfValues: 0.6000000000000001
}
]

MongoDB 6.0 and earlier output:

[
{
_id: ObjectId("6390f8085425651d8d0ef0a7"),
sumOfValues: 0.6
}
]

No Automatic Chunk Splitting

Starting in MongoDB 6.0.3, automatic chunk splitting is not performed. This is because of balancing policy improvements. Auto-splitting commands still exist, but do not perform an operation.

Starting in MongoDB 6.1, the following auto-splitting commands do not perform an operation:

Removed Options

Starting in MongoDB 6.1, journaling is always enabled. As a result, MongoDB removes the storage.journal.enabled option and the corresponding --journal and --nojournal command-line options.

Starting in MongoDB 6.1, SNMP is removed. All related command line options prevent mongod from starting. To monitor your deployment, use MongoDB Ops Manager.

Server Parameters

Starting in MongoDB 6.1, the default value for coordinateCommitReturnImmediatelyAfterPersistingDecision is false.

Sharding Metrics Changes

currentOp.opStatus is removed from the resharding metrics in MongoDB 6.1.

Views Not Permitted on Bucket Collection Namespace

You cannot create a view from a time series bucket collection namespace (namely, a collection prefixed with system.buckets).

If you are upgrading to MongoDB 6.1 from a prior version, you must drop all views which are created on system.buckets collections.