Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the MongoMigrate class more flexible #9

Open
ThibaultLemaire opened this issue Feb 24, 2020 · 1 comment
Open

Make the MongoMigrate class more flexible #9

ThibaultLemaire opened this issue Feb 24, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@ThibaultLemaire
Copy link

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.

@ThibaultLemaire ThibaultLemaire added the enhancement New feature or request label Feb 24, 2020
@rooterkyberian
Copy link
Contributor

Sounds good, especially since client can be still taken from db.client

maybe provide a classmethod to init from a pymongo.MongoClient.

doesn't sound to be necessary, since that would be just one line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants