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

'Can't canonicalize query' error when using multiple $nearSphere operators in 2.6

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: 2.6.5
    • Component/s: Geo, Querying
    • None
    • ALL
    • Hide
      > db.repro.ensureIndex({startLocation: "2d"})
      {
      	"createdCollectionAutomatically" : true,
      	"numIndexesBefore" : 1,
      	"numIndexesAfter" : 2,
      	"ok" : 1
      }
      > db.repro.ensureIndex({endLocation: "2d"})
      {
      	"createdCollectionAutomatically" : false,
      	"numIndexesBefore" : 2,
      	"numIndexesAfter" : 3,
      	"ok" : 1
      }
      
      > db.repro.find({"endLocation": {"$nearSphere": [55.60254669189453, 55.00625801086426], "$maxDistance": 0.0003385605252703308}, "startLocation": {"$nearSphere": [55.51988220214844, 55.02147674560547], "$maxDistance": 0.0003385605252703308}})
      error: {
      	"$err" : "Can't canonicalize query: BadValue Too many geoNear expressions",
      	"code" : 17287
      }
      
      Show
      > db.repro.ensureIndex({startLocation: "2d" }) { "createdCollectionAutomatically" : true , "numIndexesBefore" : 1, "numIndexesAfter" : 2, "ok" : 1 } > db.repro.ensureIndex({endLocation: "2d" }) { "createdCollectionAutomatically" : false , "numIndexesBefore" : 2, "numIndexesAfter" : 3, "ok" : 1 } > db.repro.find({ "endLocation" : { "$nearSphere" : [55.60254669189453, 55.00625801086426], "$maxDistance" : 0.0003385605252703308}, "startLocation" : { "$nearSphere" : [55.51988220214844, 55.02147674560547], "$maxDistance" : 0.0003385605252703308}}) error: { "$err" : "Can't canonicalize query: BadValue Too many geoNear expressions" , "code" : 17287 }

      We are experiencing a new error in 2.6 when running a query with multiple $nearSphere operators. This returns results in 2.4.10 without error.

            Assignee:
            ramon.fernandez@mongodb.com Ramon Fernandez Marina
            Reporter:
            tredman@fb.com Travis Redman
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: