Skip to content

Make the MongoMigrate class more flexible #9

@ThibaultLemaire

Description

@ThibaultLemaire

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions