Skip to content

Commit 5e1641c

Browse files
committed
feat: add constraint to polygon
1 parent 14be107 commit 5e1641c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/dart/lib/src/network/parse_query.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,15 @@ class QueryBuilder<T extends ParseObject> {
302302
_SINGLE_QUERY, '"$column":{"\$geoWithin":${jsonEncode(dictionary)}}'));
303303
}
304304

305+
/// Add a constraint to the query that requires a particular key's coordinates that contains a point
306+
void wherePolygonContains(String column,ParseGeoPoint point){
307+
final double latitude = point.latitude;
308+
final double longitude = point.longitude;
309+
310+
queries.add(MapEntry<String, dynamic>(_SINGLE_QUERY,
311+
'"$column":{"\$geoIntersects":{"\$point":{"__type":"GeoPoint","latitude":$latitude,"longitude":$longitude}}}'));
312+
}
313+
305314
/// Add a constraint to the query that requires a particular key's value match another QueryBuilder
306315
void whereMatchesQuery<E extends ParseObject>(
307316
String column, QueryBuilder<E> query) {

0 commit comments

Comments
 (0)