fix(db-postgres): sort by distance when the near operator is used (#12185)
Fixes https://github.com/payloadcms/payload/issues/12090, in MongoDB the documents are sorted by distance automatically whenever the `near` operation is used, which we have in the docs: > When querying using the near operator, the returned documents will be sorted by nearest first. This fixes this incosistensty between Postgres and MongoDB. ⚠️ This change potentially can cause to produce different results, if you used the `near` operator without `sort: 'pointFieldName'`.
This commit is contained in:
@@ -1218,7 +1218,6 @@ describe('collections-rest', () => {
|
||||
.GET(`/${pointSlug}`, {
|
||||
query: {
|
||||
limit: 5,
|
||||
sort: 'point',
|
||||
where: {
|
||||
point: {
|
||||
// querying large enough range to include all docs
|
||||
|
||||
Reference in New Issue
Block a user