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

No results with $near and $nearSphere queries using 2dsphere indexes and $maxDistance parameter

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 2.3.2, 2.4.0-rc0
    • Fix Version/s: None
    • Component/s: Geo, Querying
    • Labels:
    • Environment:
      Windows 7 Professional
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      1) Generate documents with 2dsphere index, including Point, LineString, and Polygon
      2) Perform query using $near without $maxDistance – should return documents
      3) Perform query using $near with $maxDistance – returns nothing

      Show
      1) Generate documents with 2dsphere index, including Point, LineString, and Polygon 2) Perform query using $near without $maxDistance – should return documents 3) Perform query using $near with $maxDistance – returns nothing

      Description

      Per the current documentation for 2dsphere indexes, queries using $near and $nearSphere require a GeoJSON point passed to them, but otherwise work normally. However, $near and $nearSphere queries against a field with a 2dsphere index return no results if a $maxDistance parameter is provided.

      e.g.
      db.random.find( {geometry: { $nearSphere:

      {type:"Point", "coordinates":[-83,40]}

      }})
      returns results, but

      db.random.find( {geometry: { $nearSphere:

      {type:"Point", "coordinates":[-83,40]}

      , $maxDistance: 10}})
      does not.

        Attachments

          Activity

            People

            Assignee:
            hari.khalsa@10gen.com hari.khalsa@10gen.com
            Reporter:
            jdagg Jim Dagg
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: