MongoDB 2.4 now available on all MongoLab plans

Greetings, mongoers!

The team here at MongoLab is very excited to announce that version 2.4 of MongoDB is now available for all of our plans!

What about current databases, you might ask? Users will be receiving an email sometime this week containing everything they need to know about the upgrade process. Keep your eyes posted on your inboxes!

2.4 Release Highlights

We've gone ahead and highlighted some of the features and changes in 2.4 that we feel are most likely to be valuable to you, our users. (You're welcome!)  For a complete list of changes in 2.4, please see the official release notes.  The highlights:

V8 JavaScript Engine

You read that right: the JavaScript engine in 2.4 is firing on more cylinders. This change affects the mapReduce, group, and eval commands, as well as the $where query operator. The primary benefit for users is better JavaScript performance, especially if you need to run multiple JavaScript operations concurrently.

For full details on JavaScript changes in 2.4 see the doc here.

New Geospatial Index and Improved Spherical Geometry

If you're building the next killer app using location services, these updates are for you. The new 2dsphere geospatial index supports improved spherical queries, as well as support for the following GeoJSON objects:

  • Point

  • LineString

  • Polygon

The 2dsphere index introduces 2 new query operators for queries on GeoJSON data:

  1. $geoWithin - use this to query for a point, line or shape that is completely contained within another shape. This operator replaces the $within operator, which is deprecated as of 2.4

  2. $geoIntersects - use this to query for locations that intersect with a GeoJSON object, including objects that have a shared edge

Complete details on geospatial indexes and queries can be found here.

There is also a great blog post from the folks at 10gen discussing these new geo features in 2.4 here.

New Update Operator: $setOnInsert

To be used with the {upsert : true} operator, the new $setOnInsert operator will set fields on a document only when the upsert operation performs an insert, and does nothing on an update.

Details on how to use this new operator can be found here.

New Array Update Modifiers

The $push operator for arrays has been updated to support 3 new modifiers that can be used to more precisely control how arrays are modified (e.g. sort or limit the size of an array after an update operation):

  • $each

  • $sort

  • $slice

Details on how to use these modifiers together to modify arrays can be found here.

If you tend you use arrays in your data model, our recent blog post might be of interest to you.

Improved Performance on count() Operations

Count von Count's favorite MongoDB operation is now up to 20x faster for low cardinality index based counts!  "AH AH AH AH AH!"

Multiple Concurrent Index Builds

Prior to 2.4, only 1 background index per database could be built at a time. With 2.4 comes the ability to run multiple background index builds concurrently. Running index builds in the background can be done like so:

> db.collection.ensureIndex({index_field : 1}, {background : true})

As always, we recommend running index builds on large collections during off-peak times. Even though background index builds are non-blocking, they are still computationally expensive operations.

Full details on this feature can be found here.

User Uniqueness Enforced

Starting in 2.4, the system.users collection enforces uniqueness on the user field.

If one of your databases has two or more users with the same username but different passwords or read privileges, you should have received an email from us containing more details and the steps you need to take to avoid any potential downtime for your app when we upgrade you to 2.4. Don't worry - you'll receive plenty of advance notice about any automagical upgrades we do to 2.4 (namely free Sandbox plans, and for-pay Shared plans that are running 2.0).

New Metrics in db.serverStatus()

(Alright, this one is probably more interesting to us here at MongoLab, but if you're one of those users who like to keep tabs on how well your database is performing, you might dig this new feature. For the rest of you, just know that this feature will help us serve you even better!)

A number of new metrics have been added to the output of the serverStatus command. One of particular interest is the new working set estimator:

  • working set estimator : the working set is the data that MongoDB uses actively. This metric will only be shown if explicitly enabled:

> db.serverStatus({workingSet : 1})

The working set section of the output looks like:

"workingSet" : {
    "note" : "thisIsAnEstimate",
    "pagesInMemory" : <num>,
    "computationTimeMicros" : <num>,
    "overSeconds" : <num>

There are a plethora of other new metrics in the new serverStatus.metrics subdocument output, too many to cover in this summary, but you can find complete details here.

Text Search (Beta)

New in 2.4 is the ability to do index-based searches on the contents of string values that have been indexed using the new text index feature.

Full documentation for the new text search feature can be found here.

The "awww, man?!?!" bit: because this is not yet GA (it is a beta feature in 2.4), it will only be available on databases created on our free Sandbox plans when you select the "experimental" checkbox. But at least you can play around with it in a Sandbox database to see if it's something you will want to leverage in your app. Hopefully come 2.6 this awesome new feature will be out of beta and fully supported!


As always, if you have any questions or thoughts please shoot us an email. We love to help!