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

unable to $and multiple geospatial queries

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.6.0-rc1
    • Component/s: Geo, Querying
    • None
    • ALL

      It looks like it has been fixed in 2.5.5 (https://jira.mongodb.org/browse/SERVER-4572)
      However, I'm using 2.6.0-rc2-pre- and the following query fails:

      db.main.find( { $and : [ { "coords": {"$geoWithin": {"$geometry": {"type":"Polygon", "coordinates": [[[-73.650458551013,41.01805351145],
                                                                                                            [-73.699751260364,41.01805351145],
                                                                                                            [-73.699751260364,40.988362588689],
                                                                                                            [-73.650458551013,40.988362588689],                                                                                                                                                                                       
                                                                                                            [-73.650458551013,41.01805351145]]]}}}},                         
                              {"coords":{"$near":{"$geometry":{"type":"Point","coordinates":[-73.6647,41.000732]}}, "$maxDistance":1609.3470878864}}] },               
                    {_id:1}
      );
      
      error: {
              "$err" : "Can't canonicalize query: BadValue geo near accepts just one argument when querying for a GeoJSON point. Extra field found: $maxDistance: 1609.3470878864",
              "code" : 17287
      }
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            rookie7799 Pavel Baranov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: