marcofognog / heroku-mongo-sync

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

Syncing system.indexes #9

Open dychen opened 9 years ago

dychen commented 9 years ago

I'm getting an error when I try to push to Heroku (with MongoLab).

"Database command 'insert' failed: not authorized on heroku_app32590136 to execute command { insert: "system.indexes", documents: [ { v: 1, key: { _id: 1 }, name: "_id_", ns: "heroku_app32590136.system.users", _id: ObjectId('5491d91ebaeecd4b93000001') } ], writeConcern: { w: 1 }, ordered: true } (Mongo::OperationFailure)"

I emailed MongoLab support and they said that increased restrictions on the system namespace in Mongo 2.6 are preventing inserting into the system.index collection. Instead, we should be using ensureIndex (see here: http://docs.mongodb.org/manual/reference/system-collections/).