marcofognog / heroku-mongo-sync

Heroku plugin to add mongo:pull and push commands
MIT License
20 stars 8 forks source link

Catch and log exceptions when syncing indexes #3

Closed joeljunstrom closed 10 years ago

joeljunstrom commented 10 years ago

I'm not a 100% sure this is the right way to go about this but we have had some problems with differences between local environments and the production env regarding old indexes.

When we sync to the local env, inserting certain indexes might throw an error due to it being incompatible with the local mongodb version.

While this is not a huge problem this patch rescues such errors and displays them after the syncing is complete.

marcofognog commented 10 years ago

Any tips on how I can reproduce the problem this commit solves?

joeljunstrom commented 10 years ago

erhm, well basically we have a few collection that have spanned a few mongodb versions. Some of the indexes have periods in them. This is apparently invalid nowadays but was generated by some ORM.

So if you can insert indexes with periods in their names you will get the error (which you can't since they are invalid =)

But thinking about it, maybe this is not something heroko-mongo-sync should have to care about. The first exception will (ofc) include the error message so maybe it's up to the user to fix it.

marcofognog commented 10 years ago

I think this is something that is up to the user to solve. Thanks for your interest in contributing anyway, it's always welcomed.