The return type for :meth:`~pymongo.collection.Collection.insert_one` and as part of :meth:`~pymongo.mongo_client.MongoClient.bulk_write`.
| 65 | |
| 66 | |
| 67 | class 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 | |
| 89 | class InsertManyResult(_WriteResult): |
no outgoing calls