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

$nearSphere with 2dsphere index (S2NearCursor) shows incorrect statistics

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.6.5
    • Component/s: Geo, Querying
    • None
    • Fully Compatible
    • ALL
    • Hide
      db.createCollection("c")
      db.c.ensureIndex({xid: 1, pos: "2dsphere"})
      db.c.find({xid: ObjectId("5475cdeeb307f5e9b8550e6d"), pos: { $nearSphere: [ 0, 0 ], $maxDistance: 0.1}}).explain()
      
      Show
      db.createCollection( "c" ) db.c.ensureIndex({xid: 1, pos: "2dsphere" }) db.c.find({xid: ObjectId( "5475cdeeb307f5e9b8550e6d" ), pos: { $nearSphere: [ 0, 0 ], $maxDistance: 0.1}}).explain()

      This is evident from performing the query directly on an empty collection that does not contain any documents.

      db.c.find({xid: ObjectId("5475cdeeb307f5e9b8550eaa"), pos: { $nearSphere: [ 0, 0 ], $maxDistance: 1}}).explain()
      
      {
      	"cursor" : "S2NearCursor",
      	"isMultiKey" : false,
      	"n" : 0,
      	"nscannedObjects" : 26,
      	"nscanned" : 26,
      	"nscannedObjectsAllPlans" : 26,
      	"nscannedAllPlans" : 26,
      	"scanAndOrder" : false,
      	"indexOnly" : false,
      	"nYields" : 0,
      	"nChunkSkips" : 0,
      	"millis" : 8,
      	"indexBounds" : {
      		
      	},
      	"server" : "aks-osx.local:37018",
      	"filterSet" : false
      }
      

      This issue is not seen in 2.8.

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            anil.kumar Anil Kumar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: