fix(db-mongodb): sort by fields in relationships with draft: true (#12387)
Fixes sorting by fields in relationships, e.g `sort: "author.name"` when using `draft: true`. The existing test that includes check with `draft: true` was accidentally passing because it used to sort by the relationship field itself.
This commit is contained in:
@@ -670,18 +670,6 @@ describe('Relationships', () => {
|
||||
await payload.delete({ collection: 'directors', where: {} })
|
||||
await payload.delete({ collection: 'movies', where: {} })
|
||||
|
||||
const director_1 = await payload.create({
|
||||
collection: 'directors',
|
||||
data: { name: 'Dan', localized: 'Dan' },
|
||||
})
|
||||
|
||||
await payload.update({
|
||||
collection: 'directors',
|
||||
id: director_1.id,
|
||||
locale: 'de',
|
||||
data: { localized: 'Mr. Dan' },
|
||||
})
|
||||
|
||||
const director_2 = await payload.create({
|
||||
collection: 'directors',
|
||||
data: { name: 'Mr. Dan', localized: 'Mr. Dan' },
|
||||
@@ -694,6 +682,18 @@ describe('Relationships', () => {
|
||||
data: { localized: 'Dan' },
|
||||
})
|
||||
|
||||
const director_1 = await payload.create({
|
||||
collection: 'directors',
|
||||
data: { name: 'Dan', localized: 'Dan' },
|
||||
})
|
||||
|
||||
await payload.update({
|
||||
collection: 'directors',
|
||||
id: director_1.id,
|
||||
locale: 'de',
|
||||
data: { localized: 'Mr. Dan' },
|
||||
})
|
||||
|
||||
const movie_1 = await payload.create({
|
||||
collection: 'movies',
|
||||
depth: 0,
|
||||
|
||||
Reference in New Issue
Block a user