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

GeoLoc does not match exact locations in 2.2.0 when there is more than one item in an index

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.3.2
    • Affects Version/s: 2.2.0
    • Component/s: Geo
    • Labels:
      None
    • ALL

      In 2.2.0 performing a find or $near on a geographic index with a secondary field to the geospatial will cause any exact locations queries to return nothing and $near will not have the exact match included in the results.

      This only effects indexes with a second field in addition to the geographical field.

      This issue doesn't occur under 2.0.7.

      Example
      Document:

      {
      	"_id" : ObjectId("4f55fd08cee147f736000000"),
      	"city" : "A",
      	"lon_lat" : [
      		1.48736,
      		42.55327
      	],
      	"population" : 100,
      }
      
      { 
      	"_id" : ObjectId("4f5606c4cee147f7362b8f59"), 
      	"city" : "B", 
      	"lon_lat" : [ 
      		-71.34895, 
      		42.46037 
      	], 
      	"population" : 1000, 
      }
      

      Index:

      { "v" : 1, "key" : { "lon_lat" : "2d", "population" : -1 }, "ns" : "test.location_categories", "min" : -180, "max" : 181, "background" : true, "name" : "lon_lat_2d_population_-1" }
      

      Query:

      db.location_categories.find({lon_lat : {$near : [-71.34895, 42.46037] } });

      Query 2:

      db.location_categories.find({lon_lat : [-71.34895, 42.46037] })

      Given the query we should match city B as it is at the co-ordinates, but is not being returned.

            Assignee:
            hari.khalsa@10gen.com hari.khalsa@10gen.com
            Reporter:
            david.hows David Hows
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: