Dyrected
Model ContentFields

Join

A virtual reverse relationship that surfaces documents pointing back at this one.

The join field is a virtual, read-only reverse lookup. It does not store data; instead it surfaces the documents in another collection whose relationship field points back at the current document. Use it to show a post's comments or an author's posts without maintaining the link on both sides.

defineJoinField({
  name: 'comments',
  label: 'Comments',
  collection: 'comments',
  on: 'post',
})

collection is the collection to pull from, and on names the relationship field over there that points back at this document. In the example, each comment has a post relationship, and the join gathers every comment whose post is the current document. Use limit to cap how many related documents come back.

Because a join is virtual, it stores nothing and is read-only in the admin panel — the link is owned entirely by the relationship field on the other collection. It is the natural partner to a Relationship: one side stores the reference, the other surfaces it in reverse.

Join field actions in the admin

On an existing document, the join field can show two helper actions in the admin:

  • Create new opens the target collection's new-document page and pre-fills the join's on relationship field with the current document id.
  • View all opens the target collection list page with a where filter that matches the join's on field to the current document id.

Both actions are shown by default. You can hide either one with join-field admin config:

defineJoinField({
  name: "comments",
  label: "Comments",
  collection: "comments",
  on: "post",
  admin: {
    showCreateButton: true,
    showViewButton: true,
  },
})

If the current document has not been saved yet, Dyrected cannot build those links, so it shows the usual “save first” message instead.

Generated reference

The contract below is generated from the public @dyrected/core exports by @dyrected/knowledge, so it stays in sync with the package. See Fields for the shared field options every type accepts.

JoinField

A virtual reverse relationship that surfaces documents pointing back at this one via collection and on. Read-only; nothing is stored on this document.

export type JoinField = TypedField<"join", unknown, JoinFieldAdmin>;

On this page

Dyrected| Cloud

Get your backend ready in minutes

Use a managed database, storage, APIs, and admin dashboard without setting up the infrastructure yourself.

Set Up My Backend