Details
-
Bug
-
Resolution: Duplicate
-
Critical - P2
-
None
-
None
-
None
-
None
-
ALL
Description
In 2.5.4:
> db.collection.insert({_id:1})
|
> db.collection.insert({_id:1})
|
E11000 duplicate key error index: test.collection.$_id_ dup key: { : 1.0 }
|
> db.getLastErrorObj()
|
{
|
"err" : "E11000 duplicate key error index: test.collection.$_id_ dup key: { : 1.0 }",
|
"code" : 11000,
|
"n" : 0,
|
"connectionId" : 1,
|
"ok" : 1
|
}
|
In nightly, git hash ed76da14b4:
> db.collection.insert({_id:1})
|
> db.collection.insert({_id:1})
|
E11000 duplicate key error index: test.collection.$_id_ dup key: { : 1.0 }
|
> db.getLastErrorObj()
|
{
|
"err" : "E11000 duplicate key error index: test.collection.$_id_ dup key: { : 1.0 }",
|
"code" : 11000,
|
"n" : 0,
|
"connectionId" : 13,
|
"syncMillis" : 0,
|
"writtenTo" : null,
|
"err" : "E11000 duplicate key error index: test.collection.$_id_ dup key: { : 1.0 }",
|
"ok" : 1
|
}
|
The shell prints "err" with the error message twice, but this is bogus. What the server actually returns is more like:
{
|
"err" : "E11000 duplicate key error index: test.collection.$_id_ dup key: { : 1.0 }",
|
"code" : 11000,
|
"n" : 0,
|
"connectionId" : 13,
|
"syncMillis" : 0,
|
"writtenTo" : null,
|
"err" : null,
|
"ok" : 1
|
}
|
The shell responds by printing the first "err" value twice. PyMongo responds by using only the second value, null, which makes it think there's no last error at all.
Attachments
Issue Links
- duplicates
-
SERVER-11955 getLastError response for failed index build contains extra copy of "err" field
-
- Closed
-