-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.3
-
Component/s: Error Handling
-
Labels:None
I was debugging an error in our application where we were able to write documents successfully, but reading them resulted in an error. The error message was simply: "false".
I had to dig into the driver code to find that it was treating one of our fields as an internal error. Our document had a boolean called "err", which happened to be false in this case... Mongo thought it was a server error and used "false" as the exception message.
com.mongodb.ServerError:
static String getMsg( BSONObject o , String def )
{ Object e = o.get( "$err" ); if ( e == null ) e = o.get( "err" ); if ( e == null ) e = o.get( "errmsg" ); if ( e == null ) return def; return e.toString(); }This contradicts http://www.mongodb.org/display/DOCS/Legal+Key+Names, which only says that you can't start a key with '$' and can't use '.' in a key.
From the same driver class, it looks like "code" is reserved too.