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

Cannot query world with 2dsphere index

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 2.4.1
    • Geo
    • 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] ] ] } } } });

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: