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

geoNear aggregate operator ignores minDistance

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Aggregation Framework, Geo
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Hide
      db.minbug.insert({ loc : { type : "Point", coordinates: [0,0] } })
      db.minbug.insert({ loc : { type : "Point", coordinates: [0,.001] } })
      db.minbug.createIndex({ loc : "2dsphere" })
      db.minbug.aggregate([{
      		$geoNear: {
      			minDistance: 10,
      			maxDistance: 100,
      			spherical: true,
      			distanceField: "distance",
      			near: {"type": "Point", "coordinates": [0,0]}
      		}
      	}]);
      

      Regardless of supplied minDistance, it will always at least return [0,0].

      Show
      db.minbug.insert({ loc : { type : "Point" , coordinates: [0,0] } }) db.minbug.insert({ loc : { type : "Point" , coordinates: [0,.001] } }) db.minbug.createIndex({ loc : "2dsphere" }) db.minbug.aggregate([{ $geoNear: { minDistance: 10, maxDistance: 100, spherical: true , distanceField: "distance" , near: { "type" : "Point" , "coordinates" : [0,0]} } }]); Regardless of supplied minDistance, it will always at least return [0,0] .

      The geoNear aggregate operator ignores the supplied minDistance. The minDistance option is not documented (http://docs.mongodb.org/manual/reference/operator/aggregation/geoNear/) but I don't see a reason why it isn't included. It isn't mentioned under the exceptions from the ordinary geoNear command.

            Assignee:
            Unassigned Unassigned
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: