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

strange object behavior in v8 shell

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.1.1
    • Affects Version/s: None
    • Component/s: JavaScript
    • Labels:
      None
    • ALL

      When I run the following script, the v8 shell seems to think the "nscanned" field of the returned document is undefined. But if I printjson the document first (see commented line), the proper nscanned field is found. This seems to occur in the v8 shell only (not the sm shell).

      git version ab7b4dbb51ac7252ecf4a3525ead615ecc243bdb

      t = db.jstests_explain4;
      t.drop();
      
      function checkField( name, value, explain ) {
          assert.eq( value, explain[ name ], name );
      }
      
      explain = t.find().explain( true );
      //printjson( explain );                                                                                                                       
      
      checkField( "cursor", "BasicCursor", explain );
      checkField( "n", 0, explain );
      checkField( "nscannedObjects", 0, explain );
      checkField( "indexBounds", {}, explain );
      checkField( "nscanned", 0, explain );
      
      

      Note the above test is a simplified version of my original test which had this issue. If you can't reproduce I can provide the original test.

            Assignee:
            antoine Antoine Girbal
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: