0

保存操作 ( $col->save($w);) 后发生异常。但我只是得到以下信息:

Fatal error: in D:\......\x.php on line 41
MongoException: in D:\......\x.php on line 41

如何获得更多信息的错误消息?是否有任何配置可以为 MongoDB 启用错误报告?

4

2 回答 2

0

To check if there was an error on the most recent db operation performed, you can use MongoDB::lastError.

var_dump($db->lastError());

For your information

If you run with driver version 1.3.0, new Mongo has been DEPRECATED. Relying on this feature is highly discouraged. Please use MongoClient instead.

于 2012-12-13T03:27:30.267 回答
0

要检查您遇到的错误,您可以检查引发异常时收到的错误代码。在 PHP driver for mongo查看错误代码

于 2012-12-01T18:43:20.850 回答