Skip to content
This repository was archived by the owner on Jul 14, 2020. It is now read-only.

Mongokit lazy_migration is not working when unsetting fields #240

@AlmogCohen

Description

@AlmogCohen

I found exactly the code responsible for the bug.
in migration.py

               doc.collection.update(self.target, self.update, multi=False, safe=safe)
                # reload
                try:
                    doc.update(doc.collection.get_from_id(doc['_id']))
                except:
                    raise OperationFailure('Can not reload an unsaved document. '
                                           '%s is not found in the database' % doc['_id'])

The local document is updated with update and therefore removed fields just stay inside the document and cause the same exception for an extra field

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions