-
Type: Task
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Integration
The $geometry docs say that $geometry must always be a valid GeoJSON spec, but we inconsistently handle syntax where $geometry is given a coordinate pair array.
$geoIntersects
This syntax is considered valid under $geoIntersects like
db.geo.find({loc: {$geoIntersects: {$geometry: [0, 0]}}})
We should either add test coverage for that query, or decide to disallow it since it's inconsistent that we allow it.
$geoWithin
$geoWithin rejects it correctly since you cannot query for "within" a point; with the error message "$within not supported with provided geometry: <>".
$near/$geoNear/$nearSphere
$near rejects it by saying "$near requires geojson point, given { 0: 0.0, 1: 0.0 }". However, that error message is misleading. $near could accept a legacy point like [0,0], so a more accurate error message would be "$geometry under $near requires a geojson point..." or simply "$geometry requires GeoJSON..." The error messages should be fixed to be more correct.