Friday , June 21 2024

MongoDB 4.0 new features in nutshell

MongoDB has grown from being a niche database solution to the Swiss army knife of the NoSQL technologies. Grigori Melnik, Head of Product, Server & Enterprise Tools at MongoDB in his recent article listed out many exciting new features and improvements of MongoDB 4.0 which is available now as a Release Candidate. So let’s have a quick look at them.

Transactions Support
This is the most awaited feature in MongoDB 4.0 which incorporates Multi-document ACID transactions. MongoDB’s existing atomicity guarantees are able to meet the data integrity needs of most applications. Adding ACID transactions support to MongoDB removes any hesitation for developers when selecting a database.

Snapshot Read Concern
Generally, readConcern option helps in achieving consistency, and isolation properties of the data. Snapshot Read Concern ensures that a consistent view of the data is returned to the client, irrespective of whether that data is being simultaneously modified by concurrent operations.

Non-Blocking Secondary Reads
MongoDB previously blocked secondary reads while oplog entries were applied. Now there is improved read latencies and increased throughput from the replica set, which helps in maintaining a consistent ordering of data. So for the applications with high write load, need not wait for readers when applying oplog batches

Extensions to Change Streams
Change streams introduced in version 3.6 helps applications to access real-time data changes without the complexity. In 4.0 Change Streams can be configured to track changes across an entire database or whole cluster. Also, it will return a cluster time associated with an event, which can be used by the application to provide an associated wall clock time for the event.

Data Type Conversions
A new expression $convert has been added to the aggregation framework. This helps in ETL workloads and simplify app development, but also allow the MongoDB BI Connector to push down large amounts of work to MongoDB Server

Improved Migrations Throughput
Sharded migrations are now up to 40% faster helping for better distribution of the data. This will definitely help much for the DB sharding.

Improved Sharding Operations
Operators can now list and kill queries running in a sharded cluster directly on a mongos node. Query terminated in any one of the shards will be reflected in all other shards too.

Slow Query Logging on mongos
In previous versions of MongoDB profiling can be enabled on the mongod. Now in 4.0 its easy to track the slow queries from mongos by enabling the profiler.

Hybrid Cursor Caching
Improvements in cursor caching unlock up to 2x performance gains on deployments running with a large number of collections and enable operations like dropping a collection to execute without causing any performance degradation on other active collections.

MongoDB 4.2 future features:
Now a bonus for this post is here.MongoDB Team has also planned for the below features for their 4.2 release.

  • Transaction compatible chunk migrations
  • More extensive WiredTiger
  • Transaction manager
  • Global point in time reads
  • Oplog applier prepare supports for transactions

Let me know which feature impressed you much in the new MongoDB 4.0 through the comments section.


About Jerwin Roy

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *