MCPcopy Index your code
hub / github.com/MongoEngine/mongoengine / to_mongo

Method to_mongo

mongoengine/document.py:297–308  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

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

Callers 3

saveMethod · 0.95
updateMethod · 0.95
to_mongoMethod · 0.45

Calls 1

getMethod · 0.45

Tested by

no test coverage detected