Skip to content

Syntax for within_polygon is slightly off #102

Description

@astjohn

The mongo docs specify the query as:

loc: {
       $geoWithin: {
          $geometry: {
             type : "Polygon" ,
             coordinates: [ [ [ 0, 0 ], [ 3, 6 ], [ 6, 1 ], [ 0, 0 ] ] ]
          }
       }
     }

Note the triple brackets.
The current changlog (the first place I happened to stumble into the documentation as I was upgrading) shows usage as:

query.geo_spacial(:location.within_polygon => [[ 1, 10 ], [ 2, 10 ], [ 1, 10 ]])

Note only double brackets. I'm not sure if this is a typo in the changelog, or if the changelog has the correct syntax and this is a bug in the query. I had to add an extra containing array (triple brackets) to make the query work. I'm also not sure if this applies to any of the other geo_spacial queries.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions