We are trying to use pymongo-migrate in a project using mongo-engine, unfortunately your MongoMigrate class doesn't really play nice with that.
After taking a look at the source, I noticed MongoMigrate only really uses a database. The client passed for initialisation is only used to get the default database.
In my case, the client I can get from mongoengine with get_connection() doesn't have a default database and the code raises an exception. However I can get the database I want with get_db().
So I thought MongoMigrate should rather take the db as a constructor argument and maybe provide a classmethod to init from a pymongo.MongoClient.
I can work on a PR if you're okay with that.
We are trying to use
pymongo-migratein a project usingmongo-engine, unfortunately yourMongoMigrateclass doesn't really play nice with that.After taking a look at the source, I noticed
MongoMigrateonly really uses a database. The client passed for initialisation is only used to get the default database.In my case, the client I can get from
mongoenginewithget_connection()doesn't have a default database and the code raises an exception. However I can get the database I want withget_db().So I thought
MongoMigrateshould rather take thedbas a constructor argument and maybe provide aclassmethodto init from apymongo.MongoClient.I can work on a PR if you're okay with that.