|
MongoDB::lastErrorCheck if there was an error on the most recent db operation performed Description
public array MongoDB::lastError
( void
)
This method is equivalent to:
<?php ParametersThis function has no parameters. Return ValuesReturns the error, if there was one. ExamplesExample #1 MongoDB::lastError
<?php The above example will output something similar to: array(3) { ["err"]=> NULL ["n"]=> int(0) ["ok"]=> float(1) } Example #2 MongoDB::lastError duplicate key example
<?php The above example will output something similar to: array(3) { ["err"]=> string(64) "E11000 duplicate key errorindex: foo.foo.$_id_ dup key: { : 1 }" ["n"]=> int(0) ["ok"]=> float(1) } |