bdragon300 / mongoengine-migrate

Migrations for MongoEngine inspired by Django
Apache License 2.0
17 stars 5 forks source link

Possibility to migrate changes on save method? #47

Open jorekai opened 3 years ago

jorekai commented 3 years ago

Hey is it possible to migrate changes in custom save methods of a document? I could not determine this by reading through the docs. Below is a small example

before changes:

class Test(Document):
  fieldA = ...
  fieldB = ...

after changes:

class Test(Document):
  fieldA = ...
  fieldB = ...
  fieldC = ...

  def save(self, *args, **kwargs):
    do_sth_with_fieldC()
    super().save()