results – Result class definitions

Result class definitions.

  • class pymongo.results.BulkWriteResult(bulk_api_result, acknowledged)
  • Create a BulkWriteResult instance.

Parameters:

  • bulk_api_result: A result dict from the bulk API
  • acknowledged: Was this write result acknowledged? If Falsethen all properties of this object will raiseInvalidOperation.
  • acknowledged
  • 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 otherattibutes of this class will raiseInvalidOperation when accessed. Values forother attributes cannot be determined if the write operation wasunacknowledged.

See also

WriteConcern

  • bulk_api_result
  • The raw bulk API result.

  • deleted_count

  • The number of documents deleted.

  • inserted_count

  • The number of documents inserted.

  • matched_count

  • The number of documents matched for an update.

  • modified_count

  • The number of documents modified.

Note

modified_count is only reported by MongoDB 2.6 and later.When connected to an earlier server version, or in certain mixedversion sharding configurations, this attribute will be set toNone.

  • upserted_count
  • The number of documents upserted.

  • upserted_ids

  • A map of operation index to the _id of the upserted document.
  • class pymongo.results.DeleteResult(raw_result, acknowledged)
  • The return type for delete_one()and delete_many()

    • acknowledged
    • 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 otherattibutes of this class will raiseInvalidOperation when accessed. Values forother attributes cannot be determined if the write operation wasunacknowledged.

See also

WriteConcern

  • deleted_count
  • The number of documents deleted.

  • raw_result

  • The raw result document returned by the server.
  • class pymongo.results.InsertManyResult(inserted_ids, acknowledged)
  • The return type for insert_many().

    • acknowledged
    • 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 otherattibutes of this class will raiseInvalidOperation when accessed. Values forother attributes cannot be determined if the write operation wasunacknowledged.

See also

WriteConcern

  • inserted_ids
  • A list of _ids of the inserted documents, in the order provided.

Note

If False is passed for the ordered parameter toinsert_many() the servermay have inserted the documents in a different order than whatis presented here.

  • class pymongo.results.InsertOneResult(inserted_id, acknowledged)
  • The return type for insert_one().

    • acknowledged
    • 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 otherattibutes of this class will raiseInvalidOperation when accessed. Values forother attributes cannot be determined if the write operation wasunacknowledged.

See also

WriteConcern

  • inserted_id
  • The inserted document’s _id.
  • class pymongo.results.UpdateResult(raw_result, acknowledged)
  • The return type for update_one(),update_many(), andreplace_one().

    • acknowledged
    • 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 otherattibutes of this class will raiseInvalidOperation when accessed. Values forother attributes cannot be determined if the write operation wasunacknowledged.

See also

WriteConcern

  • matched_count
  • The number of documents matched for this update.

  • modified_count

  • The number of documents modified.

Note

modified_count is only reported by MongoDB 2.6 and later.When connected to an earlier server version, or in certain mixedversion sharding configurations, this attribute will be set toNone.

  • raw_result
  • The raw result document returned by the server.

  • upserted_id

  • The _id of the inserted document if an upsert took place. OtherwiseNone.