MongoDB Improves Query Language
Written by Kay Ewbank   
Tuesday, 04 August 2020

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

MongoDB Website

Related Articles

Amazon Ditches MongoDB, Launches Rival

MongoDB 4 Released

MongoDB 4.0 Gets Multi-Doc ACID Support

MongoDB Stitch Makes App Development Easier

MongoDB 3.2 Released 

MonggoDB 3 Announced


To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.


BASIC Turns 60

On May 1,1964 the first BASIC program ran and the world was about to change. Now when we look back it is easy to be critical, but these were different times.

Hydraulic Atlas Bows Out, Welcome Electric Atlas

Boston Dynamics dismayed us at the beginning of the week with a video that suggested was discontinuing Atlas, its humanoid robot. Fast forward a day and its successor was unveiled. Designed to be even [ ... ]

More News

raspberry pi books



or email your comment to:

Last Updated ( Tuesday, 04 August 2020 )