MongoDB 3.6 was finally released this week and it comes with seriously exciting features.

We first got an in-depth look at the latest MongoDB version at #MDBE2017. Now that everything is official, behold our list of favorite features and what they mean for you.

Retryable Writes

There’s always room for error when writing to a database even when you think you’ve got all your bases covered. With MongoDB 3.6, you no longer run the risk of executing an update twice because of network glitches and the like, thanks to the new Retryable Writes feature.

Instead of the developer or the application, it’s now the driver itself that handles these system flukes. The MongoDB driver that comes with 3.6 can automatically retry certain failed write operations once, to recover from transient network errors or replica set failovers.

The benefit here is all in the feature name: your writes will automatically be retried by MongoDB itself, so you don’t have to worry about any write inconsistencies.

Causal Consistency

Prior to MongoDB 3.6, reading from primaries was the only reliable way to go. Causal relationships between read and write operations as they occurred on primaries (and got replicated to secondaries) weren’t guaranteed. These could result in lags (e.g. writes to the primary not replicated to the secondaries, multiple secondaries writing updates at different times, etc.) which could make reading from secondaries inconsistent.

This all changes with MongoDB 3.6, which in tl;dr format is: you can now also reliably read from secondaries. You can find the longer technical explanation here.

Change Streams

Just like you get notified about real-time changes for about almost anything these days, MongoDB is now also able to do the same through a feature called Change Streams.

The benefit of Change Streams is immediately visible. You can now subscribe to changes in a collection and get notified. A new method, called watch, listens for these changes, notifies you, and can even trigger an automatic series of events, as defined in your change stream.

Change streams can “listen” to five events for now (Insert, Delete, Replace, Update and Invalidate) and can only be set up based on user roles, which means that only those who have read access to collections can create change streams in those collections.

New Aggregation Pipeline Stages and Operators

MongoDB users can feel a bit more empowered by an aggregation pipeline that boasts new operators, stages, and an improved $lookup operator with even more powerful join capabilities.

Studio 3T’s Aggregation Editor will of course support these new additions, the full list of which you can find in the MongoDB 3.6 Release Notes.

Performance Advisor

MongoDB’s Ops Manager comes bundled with Performance Advisor, a feature that alerts you about slow queries – meaning queries that take longer than the default slowOpThresholdMs of 100 milliseconds – and suggests new indexes to improve query performance.

Indexes help speed up queries significantly, so having automated suggestions on how to optimize them is quite a leg-up. But there is a tradeoff to consider: the more indexes you have, the worse your write performance. And it’s still up to you – and not Performance Advisor – to strike the right balance.

Default Bind to localhost

In an effort to enforce security, MongoDB 3.6 now by default binds to localhost if no authentication is enabled, so that only connections from clients running on the same machine are accepted in such a case.

Only users from whitelisted IP addresses can externally connect to your unsecured databases, everything else will be denied.

Array Updates

Nested arrays are easier to manipulate that ever in MongoDB 3.6. Now, the query $type : “array" detects that fields are arrays, unlike before when it would only return documents with array fields with an element of BSON type array.

MongoDB also introduced new operators which will make updating all elements in an array much easier and with less code.

We already made showing nested fields and exploring arrays easier with Studio 3T’s improved Table View, but now you can also expect these new array updates to be supported in IntelliShell.

Leave a Comment

Your email address will not be published.

You may use these HTML tags and attributes: <a href=""> <abbr> <acronym> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>