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

$geoWithin queries not hitting 2dsphere index

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.5
    • Component/s: Geo, Index Maintenance
    • Labels:
      None
    • ALL
    • Hide

      Create a collection from MapReduce query that contains geoJson points in the value.location field. Add a 2dsphere index to that embedded field. Run a $geoWithin query such as:

      "value.avg_location" : {
      "$geoWithin" :

      { "$polygon" : [ [ -122.07496047019957, 37.65882781135178 ], [ -122.07496047019957, 37.663906822384874 ], [ -122.0871913433075, 37.663906822384874 ], [ -122.0871913433075, 37.65882781135178 ], [ -122.07496047019957, 37.65882781135178 ] ] }

      }
      },

      Show
      Create a collection from MapReduce query that contains geoJson points in the value.location field. Add a 2dsphere index to that embedded field. Run a $geoWithin query such as: "value.avg_location" : { "$geoWithin" : { "$polygon" : [ [ -122.07496047019957, 37.65882781135178 ], [ -122.07496047019957, 37.663906822384874 ], [ -122.0871913433075, 37.663906822384874 ], [ -122.0871913433075, 37.65882781135178 ], [ -122.07496047019957, 37.65882781135178 ] ] } } },

      When I run a query on an indexed location field (which contains geoJSON points) I notice that the query is doing a collection scan. Deleting the index and running the query takes about 5 minutes. After adding the index back again, the query still takes about 5 minutes. Here are the steps I've taken to debug:

      http://www.andrewkouri.com/debugging-mongodbs-2dsphere-geoindex/

            Assignee:
            wan.bachtiar@mongodb.com Wan Bachtiar
            Reporter:
            andrewkouri Andrew Kouri
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: