New features in MongoDB 3.6

MongoDB Europe 2017

MongoDbEurope
MongoDB Europe 2017 in London – James Governor discussing “Convenience is the Killer App”

This week I had front row seats at the MongoDB Europe 2017 conference in London to find out the exciting new features that have been added to the latest release 3.6. The new features have been grouped into the following categories by MongoDB:

  • Speed to Develop: Change streams, retryable writes, tunable consistency, greater query and update expressivity, and Compass Community help developers move faster.
  • Speed to Scale: Ops Manager, schema validation, enhanced security, end to end compression, and user session management help operations teams scale faster.
  • Speed to Insight: The MongoDB aggregation pipeline, Connector for BI, and the recommended R driver help analysts and data scientists unlock insights faster.

See a breakdown below of the new features that I personally got excited about whilst at the conference. (full list of features in 3.6 can be found here: https://www.mongodb.com/collateral/mongodb-36-whats-new)

Speed to Develop

MongoDb Stitch BETA – fully managed backend service

MongoDB Stitch lets developers focus on building applications rather than on managing data manipulation code, service integration, or backend infrastructure. Whether you’re just starting up and want a fully managed backend as a service, or you’re part of an enterprise and want to expose existing MongoDB data to new applications, Stitch lets you focus on building the app users want, not on writing boilerplate backend logic.

As a developer, the introduction of MongoDB Stitch in BETA was the main thing I took away from the conference. The following slide during one of the seminars shows how a MERN or MEAN app, for example, could integrate directly with Stitch without the need for the more traditional design highlighted in green below (Express/Node/Mongo etc)

stitch-slideJPG
A photo I took during a presentation by Andrew Morgan on “Developing with the modern App Stack”

MongoDB Stitch would be perfect for admin portals, review websites, monitoring dashboards etc; and during one of the hands on labs with Stitch PO Drew DiPalma, we were able to very quickly use Stitch to get an authenticated website accessing MongoDB up and running.

IMG_3575
Drew DiPalma, Product Owner for Stitch, giving us a hands on session with Stitch

The official following video gives more detail on MongoDB Stitch

Change Streams

Change streams allow developers to build reactive real-time applications that can view, filter or act upon notifications which are triggered when data has changed in the database. The application can consume the change streams via different methods, such as MongoDB Stitch, directly, or message queue. Change streams would be perfect for use cases such as real time monitoring dashboards or trading applications; as well as synchronising updates across micro-services when a particular document changes. I can personally think of one or two projects that could benefit from change streams once we go to this particular version.

changestreams

Retryable Writes

Retryable Writes help to solve the age old headache of dealing with write errors due to temporary system failures, by moving the handling logic into the database rather than the application. the MongoDB driver can now automatically retry writes when these kind of temporary failures occur, while the MongoDB server enforces exactly-once processing semantics. The server can now evaluate success of transactions based on unique identifiers sent by the driver. I’m looking forward to trying this out in practice rather than theory in a couple of test projects I am working on.

Speed to Scale

Schema Validation

Schema Validation based on syntax derived from the proposed JSON Schema standard has been added to MongoDb 3.6; allowing developers, DBAs and DevOps to define strict contracts on data structure and contents. This is something I was personally interested in as most of the time I find this type of validation is defined in JavaScript contracts per model if not using Mongoose or an equivalent. This allows:

  • Administrators can define when additional fields are allowed to be added to a document.
  • DBAs can query for all documents that do not conform to a prescribed schema.
  • Administrators can now control what happens when a document doesn’t conform to its schema; such as log the error, reject the change or allow the change to be written to the document.

An example of its use could be the following (taken from the MongoDb documentation based on a ficticios Student collection)

db.createCollection("students", {
   validator: {
      $jsonSchema: {
         bsonType: "object",
         required: [ "name", "year", "major", "gpa" ],
         properties: {
            name: {
               bsonType: "string",
               description: "must be a string and is required"
            },
            gender: {
               bsonType: "string",
               description: "must be a string and is not required"
            },
            year: {
               bsonType: "int",
               minimum: 2017,
               maximum: 3017,
               exclusiveMaximum: false,
               description: "must be an integer in [ 2017, 3017 ] and is required"
            },
            major: {
               enum: [ "Math", "English", "Computer Science", "History", null ],
               description: "can only be one of the enum values and is required"
            },
            gpa: {
               bsonType: [ "double" ],
               description: "must be a double and is required"
            }
         }
      }
   }
})

More information can be found here: https://docs.mongodb.com/master/reference/operator/query/jsonSchema/

Speed to Insight

MongoDB Connector for BI

The MongoDB Connector for BI has been greatly improved, allowing quicker insight using SQL-based BI and Analytics platforms. This enables teams to analyse data generated by different streams in modern applications, without the need to move data to other databases or sources through complex ETL processes before connecting to providers such as SAP Business Objects or Tablaeu. The connector works by:

  1. Connect The MongoDB Connector for BI provides your BI platform information about the schema of the MongoDB collection you want to analyze.
  2. Receive: It receives SQL queries from your BI platform and translates them into appropriate MongoDB queries, which are sent to MongoDB.
  3. Analyse: The connector then gets back the results, converts them into a tabular format, and sends them to your BI platform for visualisation.

Dr Hannah Fry gave a funny and insightful presentation during the conference titled “I know you better than you know yourself” where she showed the power of BI and analytics visually which I was most impressed with.

Take away points from MongoDB Europe..

Aside from Stitch, one slide in particular on MongoDB Atlas (Database as a service) stands out to me, showing the amount of time and resources that could be saved on deployments from a DevOps perspective when using Atlas:

atlas_benefits
Great slide showing the benefits of MongoDB Atlas over non-Atlas deployments

It was also great to meet and have a beer with Eliot Horowitz, the co-founder and CTO of MongoDB; as well as networking with other teams to see how they work day to day, and the technologies which they are using. Overall a fantastic experience and I would really like to go to next years.

IMG_3543
MongoDB Europe – fantastic day learning and networking

Leave a comment