[JAVA-464] driver does not properly recognize certain command errors Created: 31/Oct/11  Updated: 10/Dec/12  Resolved: 13/Jul/12

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: None
Fix Version/s: 2.9.0

Type: Bug Priority: Major - P3
Reporter: Antoine Girbal Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

when calling a command, driver checks for error using the "err" field.
But that field is not always specified, sometimes it's "errmsg".
Apparently there is a known distinction between the 2.

For example, when using an unknown "w" policy:
{ "serverUsed" : "localhost:27017" , "n" : 0 , "lastOp" :

{ "$ts" : 1319852070 , "$inc" : 1}

, "connectionId" : 82 , "errmsg" : "exception: unrecognized getLastError mode: blah" , "code" : 14830 , "ok" : 0.0} in 3ms

looks like driver should instead rely on ok=0 and then look for either err or errmsg.



 Comments   
Comment by Mathieu Ruellan [ 10/Dec/12 ]

Thank you! You make my day!
I was doing the init in a spring xml file with value="1". Replaced by ="SAFE" and that's it!

Comment by Jeffrey Yemin [ 10/Dec/12 ]

What WriteConcern are you using? If you're doing something like:

  new WriteConcern("1");

then that would trigger this error. Make sure you're using the integer 1 and not the String "1".

Comment by Mathieu Ruellan [ 10/Dec/12 ]

I'm using mongodb 2.2.2 (debian 64bit), spring-data-mongo 1.1.1-Release and java mongo drivers 2.9.3.
It works fine with spring-data-mongo-1.0.1-Release and java mongo drivers 2.7.3, but i need 2.2 features (near ReadPreferences).

I've got a similar message :

error command failed [getlasterror]: { "serverUsed" : "localhost/127.0.0.1:27017" , "n" : 0 , "lastOp" :

{ "$ts" : 1355143187 , "$inc" : 1}

, "connectionId" : 49 , "errmsg" : "exception: unrecognized getLastError mode: 1" , "code" : 14830 , "ok" : 0.0}

Any advice?

Comment by Jeffrey Yemin [ 29/Aug/12 ]

Closing as part of 2.9.0 release process.

Comment by Jeffrey Yemin [ 13/Jul/12 ]

Tracked this down finally. I had fixed it as a side effect of this commit:

Message: refactored com.mongodb.DBTCPConnector#_checkWriteError to make intent clearer.
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/3d5458e5fbbedd2381f3c675fc140eae94ea2949

Comment by Jeffrey Yemin [ 04/Jun/12 ]

That change was done in scope of JAVA-292 according to git.

Comment by Antoine Girbal [ 04/Jun/12 ]

restoring original title

Comment by Jeffrey Yemin [ 22/May/12 ]

Pushing this to 2.9.0.

Comment by Jeffrey Yemin [ 02/May/12 ]

"errmsg" is for command failures

Comment by Jeffrey Yemin [ 16/Mar/12 ]

Antoine, any idea what the known distinction is between the 2? Should the driver treat "err" and "errmsg" differently?

Generated at Thu Feb 08 08:52:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.