Moodle PHP Documentation 4.1
Moodle 4.1.11 (Build: 20240610) (c8c84b4af18)
MongoDB\BulkWriteResult Class Reference

Public Member Functions

 __construct (WriteResult $writeResult, array $insertedIds)
 
 getDeletedCount ()
 Return the number of documents that were deleted.
 
 getInsertedCount ()
 Return the number of documents that were inserted.
 
 getInsertedIds ()
 Return a map of the inserted documents' IDs.
 
 getMatchedCount ()
 Return the number of documents that were matched by the filter.
 
 getModifiedCount ()
 Return the number of documents that were modified.
 
 getUpsertedCount ()
 Return the number of documents that were upserted.
 
 getUpsertedIds ()
 Return a map of the upserted documents' IDs.
 
 isAcknowledged ()
 Return whether this update was acknowledged by the server.
 

Member Function Documentation

◆ getDeletedCount()

MongoDB\BulkWriteResult::getDeletedCount ( )

Return the number of documents that were deleted.

This method should only be called if the write was acknowledged.

See also
BulkWriteResult\isAcknowledged()
Return values
integer|null
Exceptions
BadMethodCallExceptionis the write result is unacknowledged

◆ getInsertedCount()

MongoDB\BulkWriteResult::getInsertedCount ( )

Return the number of documents that were inserted.

This method should only be called if the write was acknowledged.

See also
BulkWriteResult\isAcknowledged()
Return values
integer|null
Exceptions
BadMethodCallExceptionis the write result is unacknowledged

◆ getInsertedIds()

MongoDB\BulkWriteResult::getInsertedIds ( )

Return a map of the inserted documents' IDs.

The index of each ID in the map corresponds to each document's position in the bulk operation. If a document had an ID prior to inserting (i.e. the driver did not generate an ID), the index will contain its "_id" field value. Any driver-generated ID will be a MongoDB\BSON\ObjectId instance.

Return values
array

◆ getMatchedCount()

MongoDB\BulkWriteResult::getMatchedCount ( )

Return the number of documents that were matched by the filter.

This method should only be called if the write was acknowledged.

See also
BulkWriteResult\isAcknowledged()
Return values
integer|null
Exceptions
BadMethodCallExceptionis the write result is unacknowledged

◆ getModifiedCount()

MongoDB\BulkWriteResult::getModifiedCount ( )

Return the number of documents that were modified.

This value is undefined (i.e. null) if the write executed as a legacy operation instead of command.

This method should only be called if the write was acknowledged.

See also
BulkWriteResult\isAcknowledged()
Return values
integer|null
Exceptions
BadMethodCallExceptionis the write result is unacknowledged

◆ getUpsertedCount()

MongoDB\BulkWriteResult::getUpsertedCount ( )

Return the number of documents that were upserted.

This method should only be called if the write was acknowledged.

See also
BulkWriteResult\isAcknowledged()
Return values
integer|null
Exceptions
BadMethodCallExceptionis the write result is unacknowledged

◆ getUpsertedIds()

MongoDB\BulkWriteResult::getUpsertedIds ( )

Return a map of the upserted documents' IDs.

The index of each ID in the map corresponds to each document's position in bulk operation. If a document had an ID prior to upserting (i.e. the server did not need to generate an ID), this will contain its "_id". Any server-generated ID will be a MongoDB\BSON\ObjectId instance.

This method should only be called if the write was acknowledged.

See also
BulkWriteResult\isAcknowledged()
Return values
array
Exceptions
BadMethodCallExceptionis the write result is unacknowledged

◆ isAcknowledged()

MongoDB\BulkWriteResult::isAcknowledged ( )

Return whether this update was acknowledged by the server.

If the update was not acknowledged, other fields from the WriteResult (e.g. matchedCount) will be undefined.

Return values
boolean

The documentation for this class was generated from the following file: