-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
withinPolygon: 3 point minimum and boundary testing. #3889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3889 +/- ##
==========================================
- Coverage 90.27% 90.24% -0.04%
==========================================
Files 114 114
Lines 7578 7582 +4
==========================================
+ Hits 6841 6842 +1
- Misses 737 740 +3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few nits here and there, otherwise, it looks great!
if (polygon.length < 3) { | ||
throw new Parse.Error( | ||
Parse.Error.INVALID_JSON, | ||
'Polygon must have at least 3 points' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you be more explicit on that: ex:
bad $geoWithin value; $polygon should contain at least 3 GeoPoints
@@ -623,6 +623,12 @@ function transformConstraint(constraint, inArray) { | |||
if (!(polygon instanceof Array)) { | |||
throw new Parse.Error(Parse.Error.INVALID_JSON, 'bad $geoWithin value'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we be more specific here with:
bad $geoWithin value; $polygon should contain at least 3 GeoPoints
if (polygon.length < 3) { | ||
throw new Parse.Error( | ||
Parse.Error.INVALID_JSON, | ||
'Polygon must have at least 3 points' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here :)
I've added an additional test for open vs closed polygons. They both are supported |
Thanks |
Mongo has a 3 point minimum for $polygon and throws an error.
Also withinPolygon and withinGeoBox are inclusive
They return within and on bounds. Updated test for inclusion