Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-14171

nscanned and nscannedObjects misreported for update() operations using BasicCursor

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Duplicate
    • Affects Version/s: 2.6.1
    • Fix Version/s: None
    • Component/s: Logging
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      var tdb = db.getSiblingDB("updateLogTest")
      var coll = tdb.getCollection("c");
       
      coll.drop();
      for (var i = 0; i < 1000; i++) coll.insert({val:i});
       
      tdb.setProfilingLevel(0);
      tdb.system.profile.drop();
      tdb.setProfilingLevel(2,0);
      tdb.adminCommand({setParameter:1, logLevel:1});
       
      coll.find({val:999});
      coll.update({val:999}, {$set: {val:1000}});
       
      tdb.adminCommand({setParameter:1, logLevel:0});
      tdb.setProfilingLevel(0,100);
       
      var spQuery = tdb.system.profile.findOne({ns:"updateLogTest.c", op:"query"});
      var spUpdate = tdb.system.profile.findOne({ns:"updateLogTest.c", op:"update"});
       
      assert.eq(1000, spQuery.nscanned);
      assert.eq(1000, spQuery.nscannedObjects);
      assert.eq(1000, spUpdate.nscanned);        // fails, nscanned == 1
      assert.eq(1000, spUpdate.nscannedObjects); // fails, nscannedObjects == 1

      Show
      var tdb = db.getSiblingDB( "updateLogTest" ) var coll = tdb.getCollection( "c" );   coll.drop(); for ( var i = 0; i < 1000; i++) coll.insert({val:i});   tdb.setProfilingLevel(0); tdb.system.profile.drop(); tdb.setProfilingLevel(2,0); tdb.adminCommand({setParameter:1, logLevel:1});   coll.find({val:999}); coll.update({val:999}, {$set: {val:1000}});   tdb.adminCommand({setParameter:1, logLevel:0}); tdb.setProfilingLevel(0,100);   var spQuery = tdb.system.profile.findOne({ns: "updateLogTest.c" , op: "query" }); var spUpdate = tdb.system.profile.findOne({ns: "updateLogTest.c" , op: "update" });   assert.eq(1000, spQuery.nscanned); assert.eq(1000, spQuery.nscannedObjects); assert.eq(1000, spUpdate.nscanned); // fails, nscanned == 1 assert.eq(1000, spUpdate.nscannedObjects); // fails, nscannedObjects == 1

      Description

      update() reports nscanned = 1 and nscannedObjects = 1 when scanning 1000 documents to find the update target. find() reports nscanned = 1000 and nscannedObjects = 1000 for the identical query.

      The error appears in the system.profile collection and in the mongod log.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                norman.graham Norman Graham
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: