|
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:
<?phpParametersThis function has no parameters. Return ValuesReturns the error, if there was one. ExamplesExample #1 MongoDB::lastError
<?phpThe above example will output something similar to:
array(3) {
["err"]=>
NULL
["n"]=>
int(0)
["ok"]=>
float(1)
}
Example #2 MongoDB::lastError duplicate key example
<?phpThe 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)
}
|