|
MongoDB\Driver\Exception\BulkWriteCommandException::getWriteErrorsReturns any write errors Description
final public array MongoDB\Driver\Exception\BulkWriteCommandException::getWriteErrors()
ParametersThis function has no parameters. Return ValuesAn array of any MongoDB\Driver\WriteErrors that occurred during the execution of individual write operations. Array keys will correspond to the index of the write operation from MongoDB\Driver\BulkWriteCommand. This map will contain at most one entry if the bulk write was ordered. ExamplesExample #1 MongoDB\Driver\Exception\BulkWriteCommandException::getWriteErrors example
The above example will output something similar to: array(2) { [2]=> object(MongoDB\Driver\WriteError)#5 (4) { ["message"]=> string(78) "E11000 duplicate key error collection: db.coll index: _id_ dup key: { _id: 1 }" ["code"]=> int(11000) ["index"]=> int(2) ["info"]=> object(stdClass)#6 (0) { } } [3]=> object(MongoDB\Driver\WriteError)#7 (4) { ["message"]=> string(78) "E11000 duplicate key error collection: db.coll index: _id_ dup key: { _id: 1 }" ["code"]=> int(11000) ["index"]=> int(3) ["info"]=> object(stdClass)#8 (0) { } } } See Also
|