Like what we’re doing? Star us on GitHub!

Compound indexes

2 weeks ago

Is there a way to describe compound index for collection?

Use case:

Collection has two fields




Collection should have only unique pairs of title and value


title | value


email | google


email | yahoo

  • denolfe
    Payload Team
    2 weeks ago

    Not out of the box currently. An option would be to make an additional field that is readOnly, then write a beforeValidate hook that populates it with the 2 values concatenated.

  • Ysione
    2 weeks ago

    I see, thank you

Open the post
Continue the discussion in Discord
Can't find what you're looking for?
Get help straight from the Payload team with an Enterprise License.Learn More