results – Result class definitions (original) (raw)
Toggle table of contents sidebar
Result class definitions.
See also
This module is compatible with both the synchronous and asynchronous PyMongo APIs.
class pymongo.results.BulkWriteResult(bulk_api_result, acknowledged)¶
Create a BulkWriteResult instance.
Parameters:
- bulk_api_result (dict[_str,_ Any ]) – A result dict from the collection-level bulk write API
- acknowledged (bool) – Was this write result acknowledged? If
False
then all properties of this object will raiseInvalidOperation.
property acknowledged_: bool_¶
Is this the result of an acknowledged write operation?
The acknowledged attribute will be False
when usingWriteConcern(w=0)
, otherwise True
.
Note
If the acknowledged attribute is False
all other attributes of this class will raiseInvalidOperation when accessed. Values for other attributes cannot be determined if the write operation was unacknowledged.
property bulk_api_result_: dict[str, Any]_¶
The raw bulk write API result.
property deleted_count_: int_¶
The number of documents deleted.
property inserted_count_: int_¶
The number of documents inserted.
property matched_count_: int_¶
The number of documents matched for an update.
property modified_count_: int_¶
The number of documents modified.
property upserted_count_: int_¶
The number of documents upserted.
property upserted_ids_: dict[int, Any] | None_¶
A map of operation index to the _id of the upserted document.
class pymongo.results.ClientBulkWriteResult(bulk_api_result, acknowledged, has_verbose_results)¶
Create a ClientBulkWriteResult instance.
Parameters:
- bulk_api_result (MutableMapping [_str,_ Any ]) – A result dict from the client-level bulk write API
- acknowledged (bool) – Was this write result acknowledged? If
False
then all properties of this object will raiseInvalidOperation. - has_verbose_results (bool) – Should the returned result be verbose? If
False
, then theinsert_results
,update_results
, anddelete_results
properties of this object will raiseInvalidOperation.
property acknowledged_: bool_¶
Is this the result of an acknowledged write operation?
The acknowledged attribute will be False
when usingWriteConcern(w=0)
, otherwise True
.
Note
If the acknowledged attribute is False
all other attributes of this class will raiseInvalidOperation when accessed. Values for other attributes cannot be determined if the write operation was unacknowledged.
property bulk_api_result_: dict[str, Any]_¶
The raw bulk write API result.
property delete_results_: Mapping[int, DeleteResult]_¶
A map of successful delete operations to their results.
property deleted_count_: int_¶
The number of documents deleted.
property has_verbose_results_: bool_¶
Whether the returned results should be verbose.
property insert_results_: Mapping[int, InsertOneResult]_¶
A map of successful insertion operations to their results.
property inserted_count_: int_¶
The number of documents inserted.
property matched_count_: int_¶
The number of documents matched for an update.
property modified_count_: int_¶
The number of documents modified.
property update_results_: Mapping[int, UpdateResult]_¶
A map of successful update operations to their results.
property upserted_count_: int_¶
The number of documents upserted.
class pymongo.results.DeleteResult(raw_result, acknowledged)¶
The return type for delete_one()and delete_many()and as part of bulk_write().
Parameters:
property acknowledged_: bool_¶
Is this the result of an acknowledged write operation?
The acknowledged attribute will be False
when usingWriteConcern(w=0)
, otherwise True
.
Note
If the acknowledged attribute is False
all other attributes of this class will raiseInvalidOperation when accessed. Values for other attributes cannot be determined if the write operation was unacknowledged.
property deleted_count_: int_¶
The number of documents deleted.
property raw_result_: Mapping[str, Any]_¶
The raw result document returned by the server.
class pymongo.results.InsertManyResult(inserted_ids, acknowledged)¶
The return type for insert_many().
Parameters:
property acknowledged_: bool_¶
Is this the result of an acknowledged write operation?
The acknowledged attribute will be False
when usingWriteConcern(w=0)
, otherwise True
.
Note
If the acknowledged attribute is False
all other attributes of this class will raiseInvalidOperation when accessed. Values for other attributes cannot be determined if the write operation was unacknowledged.
property inserted_ids_: list[Any]_¶
A list of _ids of the inserted documents, in the order provided.
Note
If False
is passed for the ordered parameter toinsert_many() the server may have inserted the documents in a different order than what is presented here.
class pymongo.results.InsertOneResult(inserted_id, acknowledged)¶
The return type for insert_one()and as part of bulk_write().
Parameters:
- inserted_id (Any)
- acknowledged (bool)
property acknowledged_: bool_¶
Is this the result of an acknowledged write operation?
The acknowledged attribute will be False
when usingWriteConcern(w=0)
, otherwise True
.
Note
If the acknowledged attribute is False
all other attributes of this class will raiseInvalidOperation when accessed. Values for other attributes cannot be determined if the write operation was unacknowledged.
The inserted document’s _id.
class pymongo.results.UpdateResult(raw_result, acknowledged, in_client_bulk=False)¶
The return type for update_one(),update_many(), andreplace_one(), and as part ofbulk_write().
Parameters:
property acknowledged_: bool_¶
Is this the result of an acknowledged write operation?
The acknowledged attribute will be False
when usingWriteConcern(w=0)
, otherwise True
.
Note
If the acknowledged attribute is False
all other attributes of this class will raiseInvalidOperation when accessed. Values for other attributes cannot be determined if the write operation was unacknowledged.
Whether an upsert took place.
Added in version 4.9.
property matched_count_: int_¶
The number of documents matched for this update.
property modified_count_: int_¶
The number of documents modified.
property raw_result_: Mapping[str, Any] | None_¶
The raw result document returned by the server.
The _id of the inserted document if an upsert took place. OtherwiseNone
.