MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / upserted_id

Method upserted_id

pymongo/results.py:162–170  ·  view source on GitHub ↗

The _id of the inserted document if an upsert took place. Otherwise ``None``.

(self)

Source from the content-addressed store, hash-verified

160
161 @property
162 def upserted_id(self) -> Any:
163 """The _id of the inserted document if an upsert took place. Otherwise
164 ``None``.
165 """
166 self._raise_if_unacknowledged("upserted_id")
167 assert self.__raw_result is not None
168 if self.__in_client_bulk and self.__raw_result.get("upserted"):
169 return self.__raw_result["upserted"]["_id"]
170 return self.__raw_result.get("upserted", None)
171
172 @property
173 def did_upsert(self) -> bool:

Callers

nothing calls this directly

Calls 2

getMethod · 0.45

Tested by

no test coverage detected