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

Explain on 2dsphere find query includes "nscanned" twice, and some other inconsistencies

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.4.0-rc2
    • Component/s: Geo, Querying
    • None
    • ALL

      Steps to reproduce:

      db.places.drop()
      db.places.ensureIndex({loc: "2dsphere"})
      db.places.insert({loc: {type: "Point", coordinates: [10, 10] }, name: "restaurant"})
      db.places.find({loc: {"$geoWithin": {"$geometry": {type: "Polygon", coordinates: [ [ [5, 5], [12, 8], [10, 15], [5, 5] ] ] } } } }).explain()
      

      Returns:

      {
      	"cursor" : "S2Cursor",
      	"isMultiKey" : true,
      	"n" : 1,
      	"nscannedObjects" : 1,
      	"nscanned" : 2,
      	"nscannedObjectsAllPlans" : 1,
      	"nscannedAllPlans" : 2,
      	"scanAndOrder" : false,
      	"indexOnly" : false,
      	"nYields" : 0,
      	"nChunkSkips" : 0,
      	"millis" : 1,
      	"indexBounds" : {
      		
      	},
      	"nscanned" : 2,
      	"matchTested" : NumberLong(1),
      	"geoTested" : NumberLong(1),
      	"cellsInCover" : NumberLong(13),
      	"server" : "capslock.local:27017"
      }
      

      Do they have different meanings? Or should one be removed?

      It's also strange that the value is 2, when I only have 1 document in the collection. Is that a property of the 2dsphere index? Or multi-key?

      Lastly, why do matchTested, geoTested, cellsInCover output their values as NumberLong(..) values?

            Assignee:
            Unassigned Unassigned
            Reporter:
            thomas.rueckstiess@mongodb.com Thomas Rueckstiess
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: