relatedPosts finds records whose category field refers to the current category. on also accepts a nested path such as details.category.
Schema design
Store a relationship in one place whenever possible. A post can store its category while the category uses a Join field to retrieve its posts. This avoids synchronizing duplicate relationship arrays and remains practical when one category has many posts. For relationships with their own data, create a junction collection. For example, acategory-posts collection can contain category, post, featured, and position fields. Join fields on both related collections can then surface those records.
On PostgreSQL and SQLite, polymorphic or many-valued relationships normally use an automatically managed _rels table. A dedicated junction collection gives you direct control over that table’s fields and indexes. It can be hidden from admin navigation while Join fields provide the editing interface on either side.
Config options
Admin options
Join fields support the standard field admin options exceptdisableBulkEdit and readOnly, plus:
Returned data
A populated Join field returnsdocs, hasNextPage, and, when count: true is requested, totalDocs:
relationTo and value.
Query options
find and findByID accept a joins option. Pass false to leave every Join field out of the result, or configure each Join field by name:
Set a field to
false instead of an object to leave just that field out.
REST API
The REST API accepts the same options through ajoins query parameter:
false, such as ?joins[relatedPosts]=false. The REST API reads joins one field at a time, so ?joins=false has no effect: list each Join field instead.