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!