Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-4551

serverStatus counts duplicate key errors as inserts

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • v1.3.15
    • Affects Version/s: None
    • Component/s: manual
    • Labels:
      None
    • Environment:
      OSX 10.9

      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>
      

            Assignee:
            sam.kleinman Sam Kleinman (Inactive)
            Reporter:
            william.cross William Cross
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:
              9 years, 20 weeks ago