A look at MongoDB 3.2

A look to MongoDB 3.2

On 8 December 2015, MongoDB announced the General Availability of its new version 3.2.

This release expands the support for new storage engines, making WiredTiger the default. It includes improvements to replication and sharding and new validation capabilities, among other features. In this post will take a look at some of these changes.

MongoDB 3.2 extends the flexible storage architecture introduced by the 3.0 release, which supported two storage engines: an improved version of the storage engine used in pre-3.x MongoDB releases, called MMAPv1 (Memory Mapped Version 1), and the new WiredTiger storage engine, which becomes the default engine in release 3.2. In version 3.2 MongoDB exposes a new storage engine API which allows the database to be extended by using other plugabble storage engines that can be developed by MongoDB itself or by the community as well. In fact, this MongoDB release ships with two new supported storage engines:

  • The Encrypted storage engine: it natively encrypts database files on disk, eliminating both the management and performance overhead of external encryption mechanisms, providing an additional level of defense against the increasingly frequent data breaches.
  • The In-Memory storage engine: it is designed to serve ultra high-throughput, low-latency apps. It would be available for beta testing for now, and is expected for GA in early 2016. MongoDB allows users to mix and match multiple storage engines within a single MongoDB deployment. One can have, for example, a primary which uses an in-memory storage engine, while a secondary can be configured with a persistent storage engine.

The replication protocol has been enhanced in this release: it extends the Raft consensus algorithm, delivering faster service recovery in the event of a primary failure while maintaining compatibility with replication constructs offered in earlier MongoDB releases. In addition, MongoDB 3.2 allows users to configure the failover behavior of their replica sets with a new parameter called electionTimeMillis which specifies the time limit in milliseconds for detecting when a replica set’s primary is unreachable.

The durability guarantees for write operations across replica sets has also been enhanced with the new protocol: the success for an operation configured with a write concern that implies secondary members will only be acknowledged after the change has been committed to the memory and journal on the secondaries.

With regard to sharding, starting with MongoDB 3.2, the config servers no longer need be configured  as special-purpose mongod instances with its own synchronization protocol. They can now be deployed as standard replica sets, which enables them to span more than three data centers with up to 50 replica set members supported.

The new version provides the option to create partial indexes: a filtering expression can be specified during index creation to instruct MongoDB to only include documents that meet the desired condition. This expression must be included in a query as part of its query condition, in order for the index to be used.

In the Data Governance field, MongoDB 3.2 provides document validation within the database. It uses the standard MongoDB Query Language to provide a very flexible mechanism where users can define that they actually want to enforce some structure on their documents, by checking on data types, data ranges, and the presence of mandatory fields. In this way, data governance standards can be applied without sacrificing one of the most important MongoDB strengths over relational databases: its flexible document model.

Furthermore, MongoDB 3.2 adds new operators and stages to the aggregation framework in order to extend the options for performing analytics and generate sophisticated results with a single query.

And one more thing in the Analytics arena: using the MongoDB connector for Business Inteligence, industry-standard SQL-based BI and analytics platforms can read directly from MongoDB and represent semi-structured and unstructured data alongside traditional data in a visual way.

With this release, MongoDB broadens its catalog of use cases, and delivers major advances for deployment of  mission-critical applications. With its new tools and the improvements made in the previously existing ones, it approaches new users, too.

Beatriz Alonso Lopez

MongoDB Consultant & Oracle DBA

Leave a Reply