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

Cannot query world with 2dsphere index

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.1
    • Component/s: Geo
    • Environment:
      OSX
    • OS X
    • Hide

      db.features.insert({loc:

      {type: "Point", coordinates: [10, 10] }

      } );
      db.features.ensureIndex(

      {"loc": "2dsphere"}

      );
      db.features.find( {loc: { $geoWithin: { $geometry:

      { type: "Polygon", coordinates: [ [ [-180,-90], [180,-90], [180,90], [-180,90], [-180,-90] ] ] }

      } } });

      Show
      db.features.insert({loc: {type: "Point", coordinates: [10, 10] } } ); db.features.ensureIndex( {"loc": "2dsphere"} ); db.features.find( {loc: { $geoWithin: { $geometry: { type: "Polygon", coordinates: [ [ [-180,-90], [180,-90], [180,90], [-180,90], [-180,-90] ] ] } } } });

      I have stored some GeoJSON points in a collection, created a 2dsphere index. When I query the world I do not get back any of the points I created. I was not sure if the polygon had to be drawn in a certain direction (clockwise, counterclockwise), I tried both ways with no luck.

            Assignee:
            hari.khalsa@10gen.com hari.khalsa@10gen.com
            Reporter:
            newmanw William Newman
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: