Data / Development

MongoDB 5.0: Serverless, Live Resharding, Time Series Data

13 Jul 2021 6:45am, by

NoSQL database system provider MongoDB launched MongoDB 5.0 this week at MongoDB.live, the company’s user conference, unveiling some anticipated features such as live resharding, along with several others.

It has been three years since MongoDB released MongoDB 4.0, and five since the debut of MongoDB Atlas, the company’s managed offering, and now MongoDB 5.0 takes even more off the user’s plate with the preview of MongoDB Serverless. Andrew Davidson, vice president of cloud products at MongoDB, explained the preview of Serverless as part of a bigger trend in the space, and one that would continue.

“Moving to as-a-service, declarative, fully managed in the cloud: this is the future of databases, there’s no doubt about it. MongoDB will always have the ability to be run anywhere, that’s a key part of our value prop, but the amount of value you can achieve from having it be fully managed and just a magic endpoint in the cloud is so much higher,” Davidson said. “Beyond just being a managed database service, getting to the point of moving up yet another layer of abstraction so that people don’t even have to think at the level of resource management, capacity planning — having everything be more like I just turn on my air conditioner, I get a power bill at the end of the month — that shift for database is something that I think is definitely going to become the norm eventually.”

Davidson went on to say that he thought the serverless model was still in its early days, but that for developers coming up right now, it would become the prominent method for consuming databases, where not only the infrastructure but also future capacity planning is handled by the database provider, rather than the developer.

Beyond previewing Serverless, the introduction of MongoDB 5.0 added a number of other features, most notably including live resharding and native time series, as well as the introduction of a versioned API — which the company says will help developers to future-proof their applications, and privacy controls for multicloud deployments.

The addition of time series data, which is simply a sequence of data points indexed in time order, brings with it the ability to easily and quickly perform a number of functions that you might otherwise need to handle yourself, as a developer. Now, MongoDB handles all of that for you, said Davidson.

“You could always do these use cases in MongoDB, but you had to deal with some cognitive load of figuring out how to make it work,” he said. “Now, we make it super performant and it’s totally natural: you just take all this data in, and you can now do the window functions back out to read that data in all the ways that are optimized for time series type queries.”

Live resharding, the other focal feature of MongoDB 5.0, addresses a key pain point in the database’s ability to horizontally scale via sharding, which splits a database into smaller pieces and spreads them out over multiple nodes. To do this, a user has to pick a shard key, a choice fraught with consequences they may not consider at the time.

The company has previously written about the importance of selecting the right shard key, noting that “if you pick the wrong shard key, you can totally trash the performance of your cluster” and that it is “a one-way parachute jump; if you get it wrong, you’ll need to migrate the data to a new collection with the right shard strategy.” With Live Resharding, users can now make up for past errors and MongoDB will handle the data redistribution in the background without ever causing downtime or requiring the user to undergo a complex migration.

To that end, Davidson said: “Now, with Live Resharding, you can make a change to that shard key and MongoDB will do all the backend synchronization of the data to essentially move it appropriately to all the right shards and give you a critical section to flip over onto this new key, which just makes it so that shard is no longer a one-way door and means you don’t have to be scared of ‘Oh my God, if I make the wrong choice, I’m doomed.’ It just makes it a lot easier to move forward and take advantage of sharding for what it was built for, which is scaling.”

While these features comprise the thrust of MongoDB 5.0 and are available both in the on-prem software as well as in MongoDB Atlas, there are several more features available with this latest version, which you can read about on the website.

Correction: A previous version of this article stated that MongoDB Atlas debuted three years ago. It debuted five years ago.

A newsletter digest of the week’s most important stories & analyses.