Skip to content
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

PHPORM-221 Convert $near into $geoWithin for count used by pagination #3073

Open
wants to merge 2 commits into
base: 5.x
Choose a base branch
from

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Jul 24, 2024

Fix PHPORM-221
Fix #3063

The sorting provided by $near is not important for counting, but is useful when getting paginated results. So we can convert the operation to $geoWithin when in an aggregation.

If can try to add other unsupported operators ($geoNear and $nearSphere).

Checklist

  • Add tests and ensure they pass
  • Add an entry to the CHANGELOG.md file
  • Update documentation for new features

@GromNaN GromNaN marked this pull request as ready for review July 24, 2024 15:10
@GromNaN GromNaN requested a review from a team as a code owner July 24, 2024 15:10
@GromNaN GromNaN requested a review from alcaeus July 24, 2024 15:10
'$centerSphere' => [
$where['value']['$geometry']['coordinates'],
// Convert meters to radians
$where['value']['$maxDistance'] / 6378100,
Copy link
Member Author

Choose a reason for hiding this comment

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

$minDistance is missing

tests/QueryTest.php Outdated Show resolved Hide resolved
@alcaeus alcaeus changed the base branch from 4.8 to 5.x September 12, 2024 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

paginate() method thows an exception when query contains 'near'
1 participant