MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / InsertOneResult

Class InsertOneResult

pymongo/results.py:67–86  ·  view source on GitHub ↗

The return type for :meth:`~pymongo.collection.Collection.insert_one` and as part of :meth:`~pymongo.mongo_client.MongoClient.bulk_write`.

Source from the content-addressed store, hash-verified

65
66
67class InsertOneResult(_WriteResult):
68 """The return type for :meth:`~pymongo.collection.Collection.insert_one`
69 and as part of :meth:`~pymongo.mongo_client.MongoClient.bulk_write`.
70 """
71
72 __slots__ = ("__inserted_id",)
73
74 def __init__(self, inserted_id: Any, acknowledged: bool) -> None:
75 self.__inserted_id = inserted_id
76 super().__init__(acknowledged)
77
78 def __repr__(self) -> str:
79 return (
80 f"{self.__class__.__name__}({self.__inserted_id!r}, acknowledged={self.acknowledged})"
81 )
82
83 @property
84 def inserted_id(self) -> Any:
85 """The inserted document's _id."""
86 return self.__inserted_id
87
88
89class InsertManyResult(_WriteResult):

Callers 5

insert_oneMethod · 0.90
insert_oneMethod · 0.90

Calls

no outgoing calls

Tested by 1