Details

    • Icon: Sub-task Sub-task
    • Resolution: Done
    • Icon: Trivial - P5 Trivial - P5
    • 01112017-cleanup
    • mongodb-2.6
    • manual
    • MongoDB 2.4.4 on OSX

    Description

      1. Topic

      Error code 16535 - can't parse query (2dsphere)

      The cause of this error was due to my $geoWithin query not having a completely closed set of coordinates. However, elsewhere in the documentation it's stated that the very last point of a polygon's coordinates is implicitly connected the first, closing the polygon automatically.

      This query below throws the 16535 error, but if you uncomment the last coordinate pair that is the same as the first, it works.

      2. Suggestion - Clarify whether or not all polygons should be explicitly closed or create an exception warning in the documents for GeoJSON Queries. Could it be the difference between 2d & 2dsphere?.

      geowithin.js

      var query = {};
      query.geometry = {
      	$geoIntersects: { 
      		$geometry: { 
      			type: "Polygon",
      			coordinates: [
      				[ 
      					[ -122.3252105712, 47.74798087303008 ], 
      					[ -122.2153472900, 47.74798087303008 ], 
      					[ -122.2153472900, 47.67151416424682 ], 
      					[ -122.3252105712, 47.67151416424682 ],
      					// [ -122.3252105712, 47.74798087303008 ]
      				] 
      			]
      		} 
      	} 
      };
       
      db.zips.find(query).forEach(printjson);

      Attachments

        Activity

          People

            Unassigned Unassigned
            srhyne Stephen Rhyne
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              9 years, 1 week, 5 days ago