doucitan2544 2015-09-16 18:25
浏览 23

PHP MongoDB驱动程序结果数组中'err'和'errmsg'之间的区别是什么?

The manual for the PHP MongoDB Driver describes two different result array elements that seem to do the same thing: err and errmsg for insert/remove operations (at least, when write concerns are used).

err

If this field is non-null, an error occurred on the previous operation. If this field is set, it will be a string describing the error that occurred.

errmsg

This field is set if something goes wrong with a database command. It is coupled with ok being 0. For example, if w is set and times out, errmsg will be set to "timed out waiting for slaves" and ok will be 0. If this field is set, it will be a string describing the error that occurred.

Do these contain the same error message string? Is there additional information to be gained from one vs. the other? If I was going to use only one, which would contain the most descriptive error message, and which is most proper to use?

I'm confused as to why both exist. I realize that errmsg was added in 2.6, and I'm using 2.6, but this seems to be redundant... Thanks!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 使用C#,asp.net读取Excel文件并保存到Oracle数据库
    • ¥15 C# datagridview 单元格显示进度及值
    • ¥15 thinkphp6配合social login单点登录问题
    • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配