Description
serverStatus is counting duplicate key errors as inserts.
This is bad because a client might think that they are inserting documents when they're not.
Steps to reproduce:
- Look at the opcounter of serverStatus() increment when an insert fails to occur:
mongos> db.foo.findOne()
|
{ "_id" : 3, "a" : 1 }
|
mongos> db.serverStatus()["opcounters"]
|
{
|
"insert" : 19,
|
"query" : 9,
|
"update" : 0,
|
"delete" : 0,
|
"getmore" : 0,
|
"command" : 114
|
}
|
mongos> db.foo.insert( { _id : 3 } )
|
WriteResult({
|
"nInserted" : 0,
|
"writeError" : {
|
"code" : 11000,
|
"errmsg" : "insertDocument :: caused by :: 11000 E11000 duplicate key error index: test.foo.$_id_ dup key: { : 3.0 }"
|
}
|
})
|
mongos> db.serverStatus()["opcounters"]
|
{
|
"insert" : 20,
|
"query" : 9,
|
"update" : 0,
|
"delete" : 0,
|
"getmore" : 0,
|
"command" : 118
|
}
|
mongos>
|