-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Near Query - Broken when maxDistance to be omitted. #10521
Comments
ainsleyclark
added
status: needs-triage
Possible bug which hasn't been reproduced yet
validate-reproduction
labels
Jan 12, 2025
ainsleyclark
changed the title
Near Query - Broken
Near Query - Broken when maxDistance to be omitted.
Jan 12, 2025
github-actions
bot
removed
the
status: needs-triage
Possible bug which hasn't been reproduced yet
label
Jan 16, 2025
Thanks @r1tsuu 🤜 ! |
Hey @r1tsuu just wanted to check, this hasn't been released yet has it? |
🚀 This is included in version v3.19.0 |
This issue has been automatically locked. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the Bug
Problem
It seems as if the
near
query does not work with apoint
field when trying to query documents.A very similar problem was reported on Discord in December here.
Description
I want to query the top 4 closest centres based of a lattiude/longtitude;
maxDistance
should not apply as I just need the first 4. In the example below I'm using anafterRead
hook to populate the centres.Documentation
The documentation states:
longitude
,latitude
,maxDistance in meters (nullable)
,<minDistance in meters (nullable)
.It's not quite clear what should be passed in, but from the looks of things it should be
null
ifmaxDistance
should be omitted.Debugging
I have tried the following:
near: [coords[0], coords[1], null, 0]
- Results in no results.near: [coords[0], coords[1]]
- Results inObtaining nearby centres error: syntax error at or near ")"
,near: "${coords[1]},${coords[0]},null,0",
- Results in no results.near: [coords[0], coords[1], 999999999999, 0]
- Results in the same centres for every query, results seem spardic.Issue
It seems
null
doesn't work when passing to thenear
field whenmaxDistance
andminDistance
is to be omitted.Example:
Link to the code that reproduces this issue
https://github.com/ainsleydev/payload-near-issue
Reproduction Steps
Clone the repo or use the example attached above.
Which area(s) are affected? (Select all that apply)
area: core
Environment Info
The text was updated successfully, but these errors were encountered: