Release Notes for MongoDB 8.1
On this page
Warning
MongoDB 8.1 Not Yet Available
MongoDB 8.1 release candidates are not yet available. This version of the manual is for an upcoming release and is currently a work in progress.
Important
MongoDB 8.1 is a rapid release and is only supported for MongoDB Atlas. MongoDB 8.1 is not supported for use on-premises. For more information, see MongoDB Versioning.
To install the latest MongoDB version supported for on-premises use, MongoDB 8.0, see the MongoDB 8.0 installation instructions.
Aggregation
Aggregation Accumulators
Starting in MongoDB 8.1, the following aggregation accumulators are available:
Aggregation Stages
Starting in MongoDB 8.1, the following aggregation stages are available:
$geoNear Improvements
Starting in MongoDB 8.1, some previously failing
$geoNear
queries with hidden 2d or
2dsphere indexes will now succeed. In previous
releases, some $geoNear
queries
used to unnecessarily fail with an IndexNotFound
error when they included a hidden index due to
confusion over which index to use.
$merge Missing Fields
Starting in MongoDB 8.1, if the $merge
aggregation stage's
supporting index is not
sparse, the fields specified for the on
option can be missing or contain a null value.
Stable API
Starting in MongoDB 8.1, the renameCollection
command and
corresponding shell method, db.collection.renameCollection()
,
are included in Stable API V1.
General Changes
Query Statistics
Starting in MongoDB 8.1, query statistics are collected and reported for
count
and distinct
commands. For details, see
count Command Query Shape and
distinct Command Query Shape.
Improved Accuracy for Operation Duration Metric
Starting in MongoDB 8.1, the durationMillis
metric reported in
slow query logs accounts for
time spent processing authorization and parsing the command. As a
result, durationMillis
more closely reflects the full command
duration.
serverStatus
Metrics
Starting in MongoDB 8.1 (and 8.0.4 and 7.0.14), the indexStats
section of the serverStatus
command output tracks indexes in
prepareUnique
state.
MongoDB 8.1 adds the following server status metrics:
maxTimestampEligibleForTruncate
inchangeStreamPreImages.purgingJob
Add Comments to Query Settings
Starting in MongoDB 8.1 (and 8.0.4), you can use
setQuerySettings
to add comments to query settings. For
example, add a comment that indicates why you added query settings.
Slow Query Metrics for Disk Spilling
Starting in MongoDB 8.1, log messages for slow queries contain new metrics if the query execution writes
temporary files to disk. These metrics are prefixed by the query
execution stage that caused the query to exceed the memory limit. For
example, sortSpills
indicates the number of times that the sort
stage of query execution wrote temporary files to disk.
Metric | Description |
---|---|
| Number of times the corresponding query execution stage wrote temporary files to disk |
| Size, in bytes, of the memory released by writing temporary files to disk |
| Size, in bytes, of disk space used for temporary files |
| Number of records written to temporary files on disk |
For more information on writing temporary files to disk, see
allowDiskUse()
.
Server Parameters
Starting in MongoDB 8.1, the following server parameters are available:
Inconsistency Types
Starting in MongoDB 8.1, the following inconsistency types are available:
connectionStatus
Connection UUID
Starting in MongoDB 8.1, you can access the currently connected client's
UUID through connectionStatus.authInfo.UUID
.
Validate Command Index Specifications Output
Starting in MongoDB 8.1, the validate
command includes
index specifications in the validate.indexDetails
output field.
Validation Action for Handling Invalid Documents
Starting in MongoDB 8.1, you can set your schema's validationAction
option to errorAndLog
, in which MongoDB rejects any insert or update that
violates the validation criteria and logs the error to the mongod
log file.
For more information, see Choose How to Handle Invalid Documents.
Disk Space
Starting in MongoDB 8.1 (and 8.0.5), if disk space is running low, MongoDB will fail queries that are spilling to disk.