============================= Release Notes for MongoDB 5.1 ============================= .. default-domain:: mongodb .. contents:: On this page :local: :backlinks: none :depth: 1 :class: twocols .. include:: /includes/rapid-release-short.rst .. note:: MongoDB 5.1 Released November 9, 2021 Patch Releases -------------- .. _5.1.2-release-notes: 5.1.2 - Upcoming ~~~~~~~~~~~~~~~~ Issues fixed: - :issue:`SERVER-61839` $elemMatch w/ positional $ project SBE bug - :issue:`SERVER-61427` Unique index builds can cause a loss of availability during commit due to checking many false duplicates - :issue:`SERVER-61194` Prevent time-series bucket OID reuse with coarse granularity - :issue:`SERVER-60310` OCSP response validation should not consider statuses of irrelevant certificates - :issue:`SERVER-56227` Add user-facing command to set allowMigrations to false for a sharded collection - `All JIRA issues closed in 5.1.2 `_ - :ref:`5.1.2-changelog` .. _5.1.1-release-notes: 5.1.1 - December 9, 2021 ~~~~~~~~~~~~~~~~~~~~~~~~ Issues fixed: - :issue:`SERVER-61633` Resharding's RecipientStateMachine doesn't join thread pool for ReshardingOplogFetcher, leading to server crash at shutdown - :issue:`SERVER-61483` Resharding coordinator fails to recover abort decision on step-up, attempts to commit operation as success, leading to data inconsistency - :issue:`SERVER-61482` Updates to config.reshardingOperations wait for PrimaryOnlyService to be rebuilt while holding oplog slot, stalling replication on config server indefinitely - :issue:`SERVER-61304` Unable to use --use-system-{pcre,boost,...} with r5.1.0 - :issue:`SERVER-51329` Unexpected non-retryable error when shutting down a mongos server - `All JIRA issues closed in 5.1.1 `_ - :ref:`5.1.1-changelog` Aggregation ----------- .. _5.1-rel-notes-new-agg-stages: New Aggregation Stages ~~~~~~~~~~~~~~~~~~~~~~ MongoDB 5.1 introduces the following aggregation stages: .. list-table:: :header-rows: 1 :widths: 20 80 * - Stage - Description * - :pipeline:`$densify` - Creates new documents in a sequence of documents where values in a specified field are missing. * - :pipeline:`$documents` - Returns literal documents from input expressions. .. _5.1-rel-notes-new-agg-operators: New Aggregation Operators ~~~~~~~~~~~~~~~~~~~~~~~~~ MongoDB 5.1 introduces the following aggregation operators: .. list-table:: :header-rows: 1 :widths: 20 80 * - Operator - Description * - :expression:`$tsSecond` - .. include:: /includes/tsSecond-introduction.rst * - :expression:`$tsIncrement` - .. include:: /includes/tsIncrement-introduction.rst $geoNear accepts ``let-bound`` variables ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. include:: /includes/fact-5.1-geonear-let-allowed.rst $lookup and $graphLookup with sharded collections ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. include:: /includes/5.1-fact-sharded-lookup-graphlookup.rst General Aggregation Improvements ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Starting in MongoDB 5.1, :expression:`$dateSubtract` and :expression:`$dateAdd` report an error when an overflow is detected for ``amount`` values. Time Series Collections ----------------------- Geo Indexing for Time Series collections ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Starting in MongoDB 5.1, you can use :ref:`geo indexes ` on the ``metaField`` of time series collections. Updates and Deletes ~~~~~~~~~~~~~~~~~~~ Starting in MongoDB 5.1 (and 5.0.5), time series collections support :ref:`update and delete operations ` with limitations. Sharded Time Series Collections ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. include:: /includes/5.1/5.1-release-notes-sharded-time-series.rst .. _5.1-rel-notes-sbe: Slot-Based Query Execution Engine --------------------------------- Starting in MongoDB 5.1, a new query execution engine is used for eligible queries. If the slot based query execution engine is used, new fields are included in the query explain plan output. - The new query execution engine is used if possible. - If the new query execution engine is used, new fields are included in the :ref:`query explain plan output `. Set Slot-Based Query Execution Plan Cache Size ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can set the size of the :ref:`plan cache ` for the new query engine with the :parameter:`planCacheSize` parameter. .. include:: /includes/fact-sbe-plan-cache-motivation.rst .. _5.1-rel-notes-change-streams: Change Streams -------------- .. |change-streams| replace:: :ref:`change streams ` .. include:: /includes/change-streams-optimization.rst Indexes ------- Starting in MongoDB 5.1, you can use the :dbcommand:`collMod` database command to add the ``expireAfterSeconds`` option to an existing single-field non-TTL index. .. _5.1-rel-notes-general: General Improvements -------------------- Metadata Option Added for ``validate`` Command ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Starting in MongoDB 5.1 (and MongoDB 5.0.4), the :dbcommand:`validate` command and the :method:`db.collection.validate()` helper method have a new :ref:`metadata ` option that quickly validates collections and detects invalid index options. ``serverStatus`` Output Change ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :dbcommand:`serverStatus` includes the following new fields in its output: Aggregation Metrics - :serverstatus:`metrics.operatorCounters.match` A document which indicates how often :ref:`match expressions ` ran. Opcode Counters - :serverstatus:`opcounters.deprecated` A count of how often deprecated opcodes run. Resharding Statistics - :serverstatus:`shardingStatistics.resharding.lastOpEndingChunkImbalance` Extra Logging Fields for Slow Queries with ``getMore`` Command ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. include:: /includes/getMore-slow-queries.rst Schema Validation Errors Contain Description Field ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. include:: /includes/fact-5.1-schema-validation-description-overview.rst For an example, see :ref:`validation-description-example`. .. _5.1-rel-notes-repl-sets: Replica Sets ------------ Assert Cluster Wide Write Concern is Set When Starting or Adding Shard ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. include:: /includes/fact-5.1-fassert-shard-restart-add-CWWC.rst ``rs.reconfig`` Cluster Wide Write Concern Validation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. include:: /includes/fact-5.1-reconfig-CWWC-validation.rst ``storeFindAndModifyImagesInSideCollection`` Parameter ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Starting in MongoDB 5.1, the :parameter:`storeFindAndModifyImagesInSideCollection` parameter determines whether the temporary documents required for :ref:`retryable ` :dbcommand:`findAndModify` commands are stored in the *side* collection (``config.image_collection``). Sharded Clusters ---------------- ``mongod`` Sharded Cluster And Config Server Changes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Starting in MongoDB 5.1, when starting a :binary:`mongod` with the :option:`--configsvr ` option you must also specify a :option:`--replSet `. Starting in MongoDB 5.1, when starting a :binary:`mongod` with the :option:`--shardsvr ` option you must also specify a :option:`--replSet `. Security -------- SELinux ~~~~~~~ Starting in MongoDB 5.1, there is a new SE Linux Policy for: - MongoDB Enterprise Server - MongoDB Community Edition Server running on Red Hat Linux. The SELinux policy is for use with default installations using ``rpm`` installer packages. Report an Issue --------------- 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. .. toctree:: :titlesonly: :hidden: /release-notes/5.1-compatibility /release-notes/5.1-changelog