The return type for :meth:`~pymongo.collection.Collection.insert_many`.
| 87 | |
| 88 | |
| 89 | class InsertManyResult(_WriteResult): |
| 90 | """The return type for :meth:`~pymongo.collection.Collection.insert_many`.""" |
| 91 | |
| 92 | __slots__ = ("__inserted_ids",) |
| 93 | |
| 94 | def __init__(self, inserted_ids: list[Any], acknowledged: bool) -> None: |
| 95 | self.__inserted_ids = inserted_ids |
| 96 | super().__init__(acknowledged) |
| 97 | |
| 98 | def __repr__(self) -> str: |
| 99 | return ( |
| 100 | f"{self.__class__.__name__}({self.__inserted_ids!r}, acknowledged={self.acknowledged})" |
| 101 | ) |
| 102 | |
| 103 | @property |
| 104 | def inserted_ids(self) -> list[Any]: |
| 105 | """A list of _ids of the inserted documents, in the order provided. |
| 106 | |
| 107 | .. note:: If ``False`` is passed for the `ordered` parameter to |
| 108 | :meth:`~pymongo.collection.Collection.insert_many` the server |
| 109 | may have inserted the documents in a different order than what |
| 110 | is presented here. |
| 111 | """ |
| 112 | return self.__inserted_ids |
| 113 | |
| 114 | |
| 115 | class UpdateResult(_WriteResult): |
no outgoing calls