Skip to content
Discussion options

You must be logged in to vote

There are several lengthy discussions on this already:
#204
#357

You should only do hooks to update other documents like this if you absolutely have to. Maintaining the same data in two places usually isn't the best solution.
If you wanted to have a list of articles for a tag, it is easy to query that info if you just have a tags relationship in the articles collection. The way we handled this in the public-demo was a category summary UI field: https://github.com/payloadcms/public-demo/blob/master/src/components/CategorySummary/index.tsx

Another option to make a 3rd collection that acts like a join table. The collection would have 2 relationship fields, one for article and one for tag. Ea…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Snailedlt
Comment options

Answer selected by hunghvu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants