Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

PHPLIB-1337 Add tests on Geospatial Query Operators #25

Merged
merged 2 commits into from
Jan 16, 2024

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Jan 15, 2024

Fix PHPLIB-1337

https://www.mongodb.com/docs/manual/reference/operator/query/#geospatial

  • $geoIntersects
  • $geoWithin
  • $near skipped "legacy coordinate", not supported
  • $nearSphere skipped "legacy coordinate", not supported

@GromNaN GromNaN marked this pull request as ready for review January 16, 2024 13:46
Copy link
Member

@alcaeus alcaeus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - the special logic required for geometry keys makes a point for introducing a dedicated encoder down the line.

$result->{'$' . $key} = $this->recursiveEncode($val);
$val = $this->recursiveEncode($val);

if ($key === 'geometry') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to consider introducing a special encoder for geo operators to extract this special logic.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For everything related to geometry, we need to be compatible with a GeoJSON library instead of creating a $geometry object.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Apart from a couple of libraries that saw their last updates 9 years ago, the only PHP libraries are found are jmikola/geojson which is supported in Doctrine ODM, and brick/geo which is still in a pre-release (0.x) state but saw its last update a little more than a year ago. I'll defer to @jmikola's expertise on this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tracking in PHPLIB-1364

@GromNaN GromNaN merged commit 118184d into mongodb:0.1 Jan 16, 2024
@GromNaN GromNaN deleted the PHPLIB-1337 branch January 16, 2024 14:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants