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

Public Member Functions

 __construct (WriteResult $writeResult, array $insertedIds)
 
 getInsertedCount ()
 Return the number of documents that were inserted.
 
 getInsertedIds ()
 Return a map of the inserted documents' IDs.
 
 isAcknowledged ()
 Return whether this insert result was acknowledged by the server.
 

Member Function Documentation

◆ getInsertedCount()

MongoDB\InsertManyResult::getInsertedCount ( )

Return the number of documents that were inserted.

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

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

◆ getInsertedIds()

MongoDB\InsertManyResult::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

◆ isAcknowledged()

MongoDB\InsertManyResult::isAcknowledged ( )

Return whether this insert result was acknowledged by the server.

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

Return values
boolean

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