Document-oriented database MongoDB is now generally available in version 4.2 which introduces enhancements such as on-demand materialised views and wildcard indexing.
Wildcard indexing can be useful in scenarios where unstructured, heterogeneous datasets make creating appropriate indexes hard. Admins can use the function to create a filter of sorts that matches fields, arrays, or sub-documents in a collection, and adds the hits to a sparse index.
The idea behind on-demand materialised views is to offer a way of incrementally updating results collections generated during aggregation. In previous versions this was only possible by recalculating the whole thing. In v4.2 however, MongoDB includes a $merge operator to handle those scenarios. Compared to $out for example, it is also able to write to sharded collections and different databases, which can be useful for analytics amongst other things.
Another new addition is support for transactions distributed between sharded clusters. Client-side field level encryption which allows the protection of sensitive document fields isn’t ready for production yet. However, the feature has reached beta status with this release and can be taken for a spin.
Aside from that, MongoDB’s Query Language saw a couple of changes, meaning that users are now able to reference fields with the update and findAndModify commands. The latter can also be used to create and use pipelines, which were previously tied to the aggregate function. Other additions include a range of trigonometric expressions, one to round numerical values to a specific digit, and expanded support for regular expressions.
Those interested in more details can sign up for a free MongoDB University course which explores the features of v4.2 and gives pointers on how to update deployments. It can also be tried on MongoDB’s cloud offering Atlas, for which the company offers a code for $200 of free credits until the end of 2019 to get started (more information can be found in the announcement post).
Speaking of cloud, last year MongoDB decided to step away from using the GNU Affero General Public License for the Community Edition of its database and switched to an altered version. The Server-Side Public License is meant to place a condition – namely, to open source the code used to serve the software from the cloud – on offering MongoDB as a service to clients.
This was done as a reaction to cloud providers capitalising on the open source project and quickly lead to companies like Red Hat dropping the project from their products and AWS launching a compatible service.
A couple of months have passed since then, and while this surely wasn’t easy, the MongoDB team hasn’t been idle as the current release shows. The company even expanded and bought mobile database and synchronisation platform Realm, which both announced in April 2019.
At MongoDBs user conference MongoDB World in July, company CTO Eliot Horowitz gave a bit of insight on what’s on the roadmap for Realm, trying to disperse any fears regarding the breaking the platform by promising to use their expertise for improvements. He also fleshed out a universal sync solution from mobile data to MongoDB called MongoDB Realm, which is meant to come out “later”.