(self, *args, **kwargs)
| 109 | self._instance = state["_instance"] |
| 110 | |
| 111 | def to_mongo(self, *args, **kwargs): |
| 112 | data = super().to_mongo(*args, **kwargs) |
| 113 | |
| 114 | # remove _id from the SON if it's in it and it's None |
| 115 | if "_id" in data and data["_id"] is None: |
| 116 | del data["_id"] |
| 117 | |
| 118 | return data |
| 119 | |
| 120 | |
| 121 | class Document(BaseDocument, metaclass=TopLevelDocumentMetaclass): |