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

Cannot query world with 2dsphere index

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 2.4.1
    • Fix Version/s: None
    • Component/s: Geo
    • Labels:
    • Environment:
      OSX
    • Operating System:
      OS X
    • Steps To Reproduce:
      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

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: