MongoDB 4.4 - current LTS version is 4.4.17 released
The MongoDB version 4.4.17 was released as of 28 September 2022 covering several bug fixes. It replaces the previous 4.4.16 version.
Key enhancements in MongoDB 4.4
MongoDB 4.4 delivers many new features and enhancements. The Community Edition is available for download as open source or binary packages for free for all major Linux distros as well as for MacOS and Windows. It is available also for OpenBSD and FreeBSD through their ports (packages management systems).
Starting from this version, mongod / mongos instances now output all log messages in structured
JSON
format. Log entries are written as a series of key-value pairs, where each key indicates a log message field type, such as "severity", and each corresponding value records the associated logging information for that field type, such as "informational".Example: the following log messages in
JSON
format indicate that a mongod is listening and ready for connections:{"t":{"$date":"2020-05-18T20:18:13.533+00:00"},"s":"I", "c":"NETWORK", "id":23015, "ctx":"listener","msg":"Listening on","attr":{"address":"127.0.0.1"}}
{"t":{"$date":"2020-05-18T20:18:13.533+00:00"},"s":"I", "c":"NETWORK", "id":23016, "ctx":"listener","msg":"Waiting for connections","attr":{"port":27001,"ssl":"off"}}
Structured logging with key-value pairs allows for efficient log analysis by automated tools or log ingestion services, and makes programmatic log parsing easier and more powerful.
MongoDB Query Language and Drivers
- Union aggregation pipeline stage to blend data from multiple collections for deeper exploration and analysis.
- Custom Aggregation Expressions to extend MongoDB with your own functions, executed as part of an aggregation pipeline.
- Global Read and Write Concerns to configure cluster-wide read isolation and write durability guarantees.
- New Rust and Swift drivers.
Scale-Out Flexibility and Performance
- Refinable Shard Keys to define and refine your shard keys at any time, with no system downtime.
- Compound Hashed Shard Keys that more evenly distribute load across shards without losing data locality.
- Hedged Reads minimize p95 and p99 latencies by submitting read requests to multiple replicas and returning results as soon as the quickest node responds.
- Simultaneous Indexing and Streaming Replication that reduce replica lag to serve fresher data to your users.
Security and Other
- Mirrored Reads that pre-warm the caches of secondary replicas to reduce the impact of primary elections following an outage or after planned maintenance.
- Resumable Initial Sync to make it easier and faster to scale-out when adding new replicas or recover nodes that have fallen too far behind the rest of the cluster.
- AWS IAM Authentication that simplifies cloud-native security by reusing existing regular and temporary Amazon IAM credentials when connecting to MongoDB Atlas.
- TLS 1.3 and 50% faster client authentication to MongoDB
Syntax new features and changes
$indexStats
has some new field outputs:building
a boolean flag, indicates that an index is being builtspec
specification document for each indexshard
the specific name of a shard, if required
$merge
has been improved to output on the same collection that is being upgraded ; in addition, one can also output in a collection that appears on the pipeline like the$lookup
$planCacheStats
state has been changed to run both mongod and mongos instances in MongoDB ; it has a new field: named host, when running mongo ;PlanCache.list()
is a wrapper for$planCacheStats
aggregation stage$collStats
now accepts the query exec stats during augment documentation ; in addition, collection scans as fields with the following description:nonTailble
a 64-bit integer that performs a collection scan on several queries that do not use tailable cursortotal
a collection of queries performed collection scan which does not use a tailable cursor
$unionWith
aggregation has been added ; it is new feature that unifies collection sets, that is, it unites results of a pipeline from several collections into one set ; it allows two type of syntax, as below:$unionWith
general syntax:cd{ $unionWith: { coll: "<collection>", pipeline: [ <stage1>, ... ] } }
$unionWith
simplified version of syntax which is used to include all documents from a collection:{ $unionWith: "<collection>" } // include all documents from the specified collection
$accumulator
is another new feature that specifies a custom accumulator operator ; accumulators are operators that do not change state as documents make progress along the pipeline ; it can also be used to execute external JavaScript functions that are not supported by MongoDB ; it can be found in 3 stages of the pipeline:$bucket
stage: only outputs documents containing not less than one document input$group
stage: inputs documents by specified _id and outputs a document for each particular grouping$bucketAuto
stage: it sorts document entries into specific group numbers known as bucketsThe syntax for$accumulator
is as follows:{ $accumulator:{ init: , initArgs: , // Optional accumulate: , accumulateArgs: , merge: , finalize: , // Optional lang: } }
$function
aggregation: defines an aggregation function in JavaScript ; this operator can be used to define functions to use behaviors that are not supported by MongoDBSee below the syntax for$function
:{ $function: { body: , args: , lang: "js" } }
Supported platforms: Community Edition
- Windows: x64
- MacOS: x64
- Debian Linux 9.2 / 10 / 11: x64
- Ubuntu Linux 18.04 / 20.04: x64, arm64
- Ubuntu Linux 16.04: x64
- RedHat Linux / CentOS Linux 8.2: arm64
- RedHat Linux / CentOS Linux 6.2+ / 7.0 / 8.0: x64
- SuSE Linux 12 / 15: x64
- Amazon Linux 2: x64, arm64
- Amazon Linux: x64