(self, *args, **kwargs)
| 295 | ) |
| 296 | |
| 297 | def to_mongo(self, *args, **kwargs): |
| 298 | data = super().to_mongo(*args, **kwargs) |
| 299 | |
| 300 | # If '_id' is None, try and set it from self._data. If that |
| 301 | # doesn't exist either, remove '_id' from the SON completely. |
| 302 | if data["_id"] is None: |
| 303 | if self._data.get("id") is None: |
| 304 | del data["_id"] |
| 305 | else: |
| 306 | data["_id"] = self._data["id"] |
| 307 | |
| 308 | return data |
| 309 | |
| 310 | def modify(self, query=None, **update): |
| 311 | """Perform an atomic update of the document in the database and reload |