Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
fix: `findDistinct` by explicit ID paths in relationships and virtual fields (#14215)
Fixes `findDistinct` operation when the `field` argument is:
* an eplicit ID path inside a relationship like:
```ts
const distinct = await payload.findDistinct({ collection: 'posts', field: 'category.id' })
```
* A virtual field linked to a relationship ID field
```ts
[
{
type: 'relationship',
relationTo: 'categories',
name: 'category',
},
{
type: 'number',
name: 'categoryID',
virtual: 'category.id',
},
]
const distinct = await payload.findDistinct({ collection: 'posts', field: 'categoryID' })
``` S
Sasha committed
2b1b6eee65aa3be9b2b7ae05d2fb2ce16fde25af
Parent: a3b3865
Committed by GitHub <noreply@github.com>
on 10/16/2025, 3:45:00 PM