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

Class InsertManyResult

pymongo/results.py:89–112  ·  view source on GitHub ↗

The return type for :meth:`~pymongo.collection.Collection.insert_many`.

Source from the content-addressed store, hash-verified

87
88
89class 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
115class UpdateResult(_WriteResult):

Callers 3

insert_manyMethod · 0.90
insert_manyMethod · 0.90

Calls

no outgoing calls

Tested by 1