MongoDB 4.4 released

MongoDB 4.4 has been released with improvements to its query language and sharding. MongoDB is a NoSQL document database that stores its documents in a JSON-like format with schema.

The first group of updates is to the MongoDB Query Language (MQL), specifically to the Aggregation Pipeline with new Union and Custom Aggregation Expressions.

The new union with aggregation pipeline stage makes it possible to  blend data from multiple collections and aggregation pipelines into a single result set in the database.It provides similar functionality to SQL’s UNION ALL operator, but source collections aren’t constrained by needing matching schemas, and Union aggregations can be scaled-out across collections spanning multiple shards.

The new support for custom aggregation expressions means developers can define custom expressions in JavaScript and use those as part of an aggregation pipeline. In earlier versions of MongoDB, you could execute custom expressions via MapReduce, but having them available as part of an aggregation pipeline simplifies their use and supports more efficient syntax and execution.

Improvements have also been made to make scaling out more flexible and faster. You can now redefine shard keys at any time without system downtime, and compound hashed shard keys are now supported that distribute load across shards more evenly without losing data locality.

Another addition is support for hedged reads. These minimize latency by submitting read requests to multiple replicas and returning the results as soon as the quickest node responds.

New streaming replication support means messages are now continuously streamed from the primary to secondary nodes. Until this release, secondary replicas would poll the primary, receiving messages in 16MB batches. The developers say their tests have measured performance improvements of up to 50% over high load, high latency networks.

Support has also been added for simultaneous Indexing, meaning new indexes are now built concurrently on the primary and all secondaries, and are available when all eligible nodes in the replica set have successfully created the index. This reduces the chances of replication lag.

More Information