Skip to content

Possibility of embedding a clone of a document as embedded #1071

Open
@aop

Description

@aop

My current issue arises from the need of snapshotting documents for later use.

Say I have a

    class User(Document):
        name = StringField()

and a

    class Message(Document):
        message = StringField()
        user = DynamicField()

For every message that the user sends I'd like to save a copy of the user in case the user changes his name, I'd see what the user looked like when he sent the message.
The example might not make any sense but the idea should be clear. Previously (I think < 0.10) I could create a Document by inheriting both Document and EmbeddedDocument, but for some reason that is not possible any more.

How could I implement snapshotting of Documents as EmbeddedDocuments, or if not elegantly possible, it would be a nice feature. I think making multiple inheritance from Document and EmbeddedDocument would be best.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions