I'm using the near operator to query a list of locations based on their proximity from me. The items seem to be returned in random order instead of the nearest first as defined in the documentation.
const lng = myProfile.location[0]
const lat = myProfile.location[1]
const query = {
location: {
near: [
lng,
lat,
10000,
]
},
and: [
{
subcategories: {
equals: subcategory,
}
},
]
};
const stringifiedQuery = qs.stringify(
{
where: query,
},
{ addQueryPrefix: true },
);
I'm using Payload 1.9.1. Could this be a bug?
Ahh looks like it's a known issue
Upgrading to the latest version fixed the issue 👍
Star
Discord
online
Get dedicated engineering support directly from the Payload team.