2dsphere Index Upgrade to 3.2

315 views
Skip to first unread message

Tim Segraves

unread,
Feb 13, 2016, 12:30:10 PM2/13/16
to mongodb-user
Hi,

I'm planning on upgrading our production DB from 3.0 to 3.2 this weekend.  Looking at the compatibility notes I saw this note talking about version 3 of the 2dsphere index.  It's not exactly clear if I need to do anything (like rebuild the index) after the upgrade or if it's just saying that once you upgrade, you won't be able to use the index if you were to downgrade to 3.0.  Has anyone done this upgrade or have any advice?  Thanks!

Tim

Wan Bachtiar

unread,
Feb 14, 2016, 6:51:16 PM2/14/16
to mongodb-user

Hi Tim,

The 2dshere version 3 index created in MongoDB v3.2 is not compatible with MongoDB v3.0. MongoDB v3.0 will not start and throw you an error similar to :

2016-02-15T09:48:21.219+1100 I STORAGE  [initandlisten] exception in initAndListen: 17395 unsupported geo index version { 2dsphereIndexVersion : 3 }, only support versions: [1,2], terminating

However, if you are upgrading from v3.0 to v3.2 existing 2dsphere version 2 index should work fine in v3.2.

Remember to always backup all of your data before upgrading MongoDB. Also see:

Regards,

Wan.

Tim Segraves

unread,
Feb 15, 2016, 10:02:24 AM2/15/16
to mongodb-user
Great, thanks for the clarification Wan.

So in order to take advantage of the performance improvements in the v3 2dsphere index do I need to drop and recreate the index after doing the upgrade?  Thanks,

Tim

Tim Segraves

unread,
Feb 15, 2016, 7:01:59 PM2/15/16
to mongodb-user
I think I answered my own question on this one.  I just ran the .getIndexes() command on my collection and see the following:
{
"v" : 1,
"key" : {
"location" : "2dsphere",
"city_id" : 1
},
"name" : "location_2dsphere_city_id_1",
"ns" : "revaluate.area_records",
"2dsphereIndexVersion" : 2
},

So I see the 2dsphereIndexVersion is set to 2 so I think I need to drop and recreate my indexes to take advantage of the new performance enhancements. 

Tim
Reply all
Reply to author
Forward
0 new messages