Relationships that point to a single record are displayed in your back-office as links.Once configured, they appear in charts, filters, scopes, and segments.
For performance reasons when sorting a Table View on customizer-defined relationships, Forest will always sort on the primary key of the related collection.
Many-to-One relationships are by far the most common type of relationship: many records from a Collection are attached to another Collection record.Think about countries and towns: a town belongs to a single country, but each country can have multiple towns.
In a one-to-one relationship, there is a one-to-one mapping between records in 2 Collections. The relationship can be unset for some records, but no record from the first Collection can be linked to more than one record in the other Collection.Think about cities and mayors: A city can have at most one mayor, and each mayor belongs to a single city.
Take note that the inverse of a one-to-one is a many-to-one.This may seem counter-intuitive: the side of the relationship which should be configured as many-to-one is the one that carries the foreign key.
// Configure one side of the relationship ...agent.customizeCollection('mayors', collection => { collection.addOneToOneRelation('city', 'cities', { originKey: 'mayor_id', originKeyTarget: 'id', // Optional (uses `mayors` primary key by default) });});// ... and the other one.agent.customizeCollection('cities', collection => { // ⚠️ Not 'OneToOne' collection.addManyToOneRelation('mayor', 'mayors', { foreignKey: 'mayor_id', foreignKeyTarget: 'id', // Optional (uses `mayors` primary key by default) });});
ForestAdmin.customize do # Configure one side of the relationship ... customize_collection('mayors') do |collection| collection.add_one_to_one_relation('city', 'cities', origin_key: 'mayor_id', origin_key_target: 'id' # Optional (uses `mayors` primary key by default) ) end # ... and the other one. customize_collection('cities') do |collection| # ⚠️ Not 'one_to_one' collection.add_many_to_one_relation('mayor', 'mayors', foreign_key: 'mayor_id', foreign_key_target: 'id' # Optional (uses `mayors` primary key by default) ) endend
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Forest Documentation","colors":{"primary":"#3F5B1E","light":"#DDF327","dark":"#3F5B1E"},"logo":{"light":"https://mintcdn.com/forest/ZO8t9buUjTuKyt-F/images/Standard.svg?fit=max\u0026auto=format\u0026n=ZO8t9buUjTuKyt-F\u0026q=85\u0026s=d4e172941c964df57009cfa8be809b96","dark":"https://mintcdn.com/forest/ZO8t9buUjTuKyt-F/images/LIME.svg?fit=max\u0026auto=format\u0026n=ZO8t9buUjTuKyt-F\u0026q=85\u0026s=91e95470256b93527860cba6c206cbc4"},"favicon":{"light":"https://mintcdn.com/forest/ZO8t9buUjTuKyt-F/images/Standard.svg?fit=max\u0026auto=format\u0026n=ZO8t9buUjTuKyt-F\u0026q=85\u0026s=d4e172941c964df57009cfa8be809b96","dark":"https://mintcdn.com/forest/ZO8t9buUjTuKyt-F/images/LIME.svg?fit=max\u0026auto=format\u0026n=ZO8t9buUjTuKyt-F\u0026q=85\u0026s=91e95470256b93527860cba6c206cbc4"},"navbar":{"links":[{"href":"mailto:support@forestadmin.com","label":"Support"}],"primary":{"type":"button","label":"Dashboard","href":"https://app.forestadmin.com"}},"footer":{"socials":{"twitter":"https://twitter.com/forest_admin","github":"https://github.com/ForestAdmin","linkedin":"https://linkedin.com/company/forestadmin"}},"contextual":{"options":["copy","view","claude","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"forest","hasAudioNarration":false,"actualSubdomain":"forest","customDomains":["docs.forest.app"],"gitSource":{"type":"github","owner":"forestadmin","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6adb428a343e8b4158140116","collectionId":"5365b6a4-fce8-4b58-90bc-27e15a3e4242","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6adb428a343e8b4158140116"},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"DISABLED"},"CONTEXTUAL_FEEDBACK":{"status":"DISABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"DISABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6adb428a343e8b4158140116","clientVersion":"0.0.3966","searchFilterCounts":[{"language":"default","tag":"Legacy","count":289},{"language":"default","tag":"JavaScript Agents","count":141},{"language":"default","tag":"Ruby Agent","count":140},{"language":"default","tag":"Product","count":113},{"language":"default","tag":"Integrations","count":64},{"language":"default","tag":"Actions","count":48},{"language":"default","tag":"Smart Action Examples","count":34},{"language":"default","tag":"Process","count":32},{"language":"default","tag":"Upgrade","count":31},{"language":"default","tag":"Connect","count":30}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true,"deflection":{"enabled":true,"email":"support@forestadmin.com"}},"hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"isAtlas":false,"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"product/process/relationships/single-record","slug":"/product/process/relationships/single-record","pageMetadata":{"title":"Single-record relationships","description":null,"href":"/product/process/relationships/single-record"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,p:`p`,pre:`pre`,span:`span`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,Info,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Info)_missingMdxReference(`Info`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Relationships that point to a single record are displayed in your back-office as links.`}),`\n`,_jsx(_components.p,{children:`Once configured, they appear in charts, filters, scopes, and segments.`}),`\n`,_jsx(Info,{children:_jsx(_components.p,{children:`For performance reasons when sorting a Table View on customizer-defined relationships, Forest will always sort on the primary key of the related collection.`})}),`\n`,_jsx(Heading,{level:`2`,id:`many-to-one-relationships`,children:`Many-to-One relationships`}),`\n`,_jsx(_components.p,{children:`Many-to-One relationships are by far the most common type of relationship: many records from a Collection are attached to another Collection record.`}),`\n`,_jsx(_components.p,{children:`Think about countries and towns: a town belongs to a single country, but each country can have multiple towns.`}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`Node.js / Cloud`,numberOfLines:`6`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`agent`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`customizeCollection`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'towns'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`collection`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` =>`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` collection`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`addManyToOneRelation`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'country'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'countries'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` foreignKey:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'country_id'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` foreignKeyTarget:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'id'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\"// Optional (uses `country` primary key by default)\"})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`Ruby`,numberOfLines:`8`,language:`ruby`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`ruby`,children:_jsxs(_components.code,{language:`ruby`,numberOfLines:`8`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`ForestAdmin`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`customize`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` do`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` customize_collection`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'towns'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`do`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`collection`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`|`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` collection.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`add_many_to_one_relation`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'country'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'countries'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` foreign_key:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'country_id'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` foreign_key_target:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'id'`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\" # Optional (uses `country` primary key by default)\"})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` )`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` end`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`})}),`\n`]})})})]}),`\n`,_jsx(Heading,{level:`2`,id:`one-to-one-relationships`,children:`One-to-One relationships`}),`\n`,_jsx(_components.p,{children:`In a one-to-one relationship, there is a one-to-one mapping between records in 2 Collections. The relationship can be unset for some records, but no record from the first Collection can be linked to more than one record in the other Collection.`}),`\n`,_jsx(_components.p,{children:`Think about cities and mayors: A city can have at most one mayor, and each mayor belongs to a single city.`}),`\n`,_jsxs(Warning,{children:[_jsxs(_components.p,{children:[`Take note that the inverse of a `,_jsx(_components.code,{children:`one-to-one`}),` is a `,_jsx(_components.code,{children:`many-to-one`}),`.`]}),_jsxs(_components.p,{children:[`This may seem counter-intuitive: the side of the relationship which should be configured as `,_jsx(_components.code,{children:`many-to-one`}),` is the one that carries the foreign key.`]})]}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`Node.js / Cloud`,numberOfLines:`16`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`16`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Configure one side of the relationship ...`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`agent`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`customizeCollection`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'mayors'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`collection`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` =>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` collection`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`addOneToOneRelation`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'city'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'cities'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` originKey:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'mayor_id'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` originKeyTarget:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'id'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\"// Optional (uses `mayors` primary key by default)\"})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// ... and the other one.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`agent`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`customizeCollection`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'cities'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`collection`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` =>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // ⚠️ Not 'OneToOne'`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` collection`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`addManyToOneRelation`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'mayor'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'mayors'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` foreignKey:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'mayor_id'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` foreignKeyTarget:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'id'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\"// Optional (uses `mayors` primary key by default)\"})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`Ruby`,numberOfLines:`18`,language:`ruby`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`ruby`,children:_jsxs(_components.code,{language:`ruby`,numberOfLines:`18`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`ForestAdmin`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`customize`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` do`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Configure one side of the relationship ...`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` customize_collection`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'mayors'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`do`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`collection`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`|`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` collection.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`add_one_to_one_relation`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'city'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'cities'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` origin_key:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'mayor_id'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` origin_key_target:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'id'`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\" # Optional (uses `mayors` primary key by default)\"})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` )`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` end`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # ... and the other one.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` customize_collection`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'cities'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`do`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`collection`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`|`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # ⚠️ Not 'one_to_one'`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` collection.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`add_many_to_one_relation`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'mayor'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'mayors'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` foreign_key:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'mayor_id'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` foreign_key_target:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'id'`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\" # Optional (uses `mayors` primary key by default)\"})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` )`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` end`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`end`})}),`\n`]})})})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Single-record relationships","description":null,"href":"/product/process/relationships/single-record"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Many-to-One relationships","slug":"many-to-one-relationships","depth":2,"children":[]},{"title":"One-to-One relationships","slug":"one-to-one-relationships","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"forest","siteName":"Forest Documentation","title":"Single-record relationships - Forest Documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-15T15:39:15.362Z","originalFileLocation":"product/process/relationships/single-record.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"Forest Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/forest/9euPPsOQWnB89Kt3/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/forest/9euPPsOQWnB89Kt3/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/forest/9euPPsOQWnB89Kt3/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/forest/9euPPsOQWnB89Kt3/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/forest/9euPPsOQWnB89Kt3/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/forest/9euPPsOQWnB89Kt3/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/forest/9euPPsOQWnB89Kt3/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/forest/9euPPsOQWnB89Kt3/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/forest/9euPPsOQWnB89Kt3/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Single-record relationships - Forest Documentation\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Forest Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.forest.app/product/process/relationships/single-record\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://forest.mintlify.app/_mintlify/api/og/v2?division=Relationships\u0026amp;title=Single-record+relationships\u0026amp;theme=7cc620c0b37a08e7a7deb699\u0026amp;signature=1d6052d4eb236d503a59feee19b39a0eccad33befdc4ccf9137219591fdf374a\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Single-record relationships - Forest Documentation\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://forest.mintlify.app/_mintlify/api/og/v2?division=Relationships\u0026amp;title=Single-record+relationships\u0026amp;theme=7cc620c0b37a08e7a7deb699\u0026amp;signature=1d6052d4eb236d503a59feee19b39a0eccad33befdc4ccf9137219591fdf374a\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/forest/9euPPsOQWnB89Kt3/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Forest Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#3F5B1E\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.forest.app/product/process/relationships/single-record\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/product/process/relationships/single-record.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.forest.app/#organization\",\"name\":\"Forest Documentation\",\"url\":\"https://docs.forest.app\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/forest/ZO8t9buUjTuKyt-F/images/Standard.svg?fit=max\u0026auto=format\u0026n=ZO8t9buUjTuKyt-F\u0026q=85\u0026s=d4e172941c964df57009cfa8be809b96\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.forest.app#website\",\"name\":\"Forest Documentation\",\"url\":\"https://docs.forest.app\",\"publisher\":{\"@id\":\"https://docs.forest.app/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.forest.app/product/process/relationships/single-record#webpage\",\"url\":\"https://docs.forest.app/product/process/relationships/single-record\",\"name\":\"Single-record relationships\",\"dateModified\":\"2026-10-15T15:39:15.362Z\",\"isPartOf\":{\"@id\":\"https://docs.forest.app#website\"},\"breadcrumb\":{\"@id\":\"https://docs.forest.app/product/process/relationships/single-record#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.forest.app/product/process/relationships/single-record#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Process\",\"item\":\"https://docs.forest.app/product/process/actions/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Relationships\",\"item\":\"https://docs.forest.app/product/process/relationships/overview\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Single-record relationships\",\"item\":\"https://docs.forest.app/product/process/relationships/single-record\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.forest.app/product/process/relationships/single-record#article\",\"headline\":\"Single-record relationships\",\"name\":\"Single-record relationships\",\"url\":\"https://docs.forest.app/product/process/relationships/single-record\",\"mainEntityOfPage\":{\"@id\":\"https://docs.forest.app/product/process/relationships/single-record#webpage\"},\"dateModified\":\"2026-10-15T15:39:15.362Z\",\"publisher\":{\"@id\":\"https://docs.forest.app/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.forest.app#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Forest Documentation\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Forest Documentation","nav":{"global":null,"tabs":[{"tab":"Home","pages":[{"title":"Home","href":""}]},{"tab":"Get Started","pages":[{"title":"Get Started","href":"/get-started/intro-to-forest-admin"}]},{"tab":"Product","groups":[{"group":"Overview","pages":[{"title":"Product","href":"/product/overview"}]},{"group":"Connect","pages":[{"title":"Overview","href":"/get-started/connect/overview"},{"title":"Architecture","href":"/get-started/connect/architectures/self-hosted"},{"title":"Deployment options","href":"/get-started/connect/architectures/deployment-options"},{"group":"Data Sources","pages":[{"title":"Add datasources to your project","href":"/get-started/connect/data-sources/overview"},{"title":"SQL datasource","href":"/get-started/connect/data-sources/sql"},{"title":"Sequelize datasource","href":"/get-started/connect/data-sources/sequelize"},{"title":"Mongoose datasource","href":"/get-started/connect/data-sources/mongoose"},{"title":"MongoDB datasource","href":"/get-started/connect/data-sources/mongodb"},{"title":"Dummy datasource","href":"/get-started/connect/data-sources/dummy"},{"title":"ActiveRecord datasource","href":"/get-started/connect/data-sources/active-record"},{"title":"Mongoid datasource","href":"/get-started/connect/data-sources/mongoid"},{"title":"Hubspot","href":"/get-started/connect/data-sources/hubspot"},{"title":"Elasticsearch","href":"/get-started/connect/data-sources/elasticsearch"},{"title":"Airtable","href":"/get-started/connect/data-sources/airtable"},{"title":"Stripe","href":"/get-started/connect/data-sources/stripe"},{"title":"RPC","href":"/get-started/connect/data-sources/rpc"},{"title":"GraphQL / Hasura","href":"/get-started/connect/data-sources/graphql-hasura"},{"title":"CosmosDB","href":"/get-started/connect/data-sources/cosmosdb"},{"title":"Snowflake","href":"/get-started/connect/data-sources/snowflake"},{"title":"Pylon","href":"/get-started/connect/data-sources/pylon"},{"title":"Zendesk","href":"/get-started/connect/data-sources/zendesk"},{"group":"Custom datasources","pages":[{"title":"Overview","href":"/get-started/connect/data-sources/custom-datasources/overview"},{"title":"Translation","href":"/get-started/connect/data-sources/custom-datasources/translation"},{"title":"Replication","href":"/get-started/connect/data-sources/custom-datasources/replication"}]}]},{"group":"Integrations","pages":[{"title":"All integrations","href":"/get-started/connect/integrations/overview"},{"title":"MCP Connectors","href":"/get-started/connect/integrations/mcp-servers"},{"title":"Forest Gateway","href":"/product/embed/gateway"},{"title":"Standalone Forest Gateway","href":"/product/embed/gateway-standalone"},{"title":"Zendesk App","href":"/product/embed/zendesk"},{"title":"n8n Node","href":"/product/embed/n8n"}]},{"group":"Advanced Concepts","pages":[{"title":"Environment Variables","href":"/get-started/connect/environment-variables"},{"title":"Data Types","href":"/get-started/connect/data-types"},{"title":"Relationships","href":"/get-started/connect/relationships-schema"},{"title":"TypeScript Autocompletion","href":"/get-started/connect/typescript-autocompletion"},{"title":".forestadmin-schema.json","href":"/reference/schema/forestadmin-schema"}]}]},{"group":"Process","pages":[{"group":"Actions","pages":[{"title":"Overview","href":"/product/process/actions/overview"},{"title":"No-code actions","hidden":true,"href":"/product/process/actions/nocode-actions"},{"group":"Code-based actions","pages":[{"title":"Overview","href":"/product/process/actions/custom-actions/overview"},{"title":"Forms","href":"/product/process/actions/custom-actions/forms"},{"title":"Result types","href":"/product/process/actions/custom-actions/result-types"},{"title":"Context \u0026 scope","href":"/product/process/actions/custom-actions/context-scope"},{"title":"Related data invalidation","href":"/product/process/actions/custom-actions/related-data-invalidation"}]}]},{"group":"Fields","pages":[{"title":"Overview","href":"/product/process/fields/overview"},{"title":"Computed fields","href":"/product/process/fields/computed"},{"title":"Import, rename \u0026 remove fields","href":"/product/process/fields/import-rename-remove"},{"title":"Field validation","href":"/product/process/fields/validation"},{"title":"Writing behavior","href":"/product/process/fields/write"},{"title":"Filtering \u0026 Sorting","href":"/product/process/fields/filter"},{"title":"Binary fields","href":"/product/process/fields/binary"}]},{"group":"Segments","pages":[{"title":"Creating segments","href":"/product/process/segments/creating-segments"},{"title":"Code-based segments","href":"/product/process/segments/smart-segments/overview"}]},{"group":"Relationships","pages":[{"title":"Overview","description":null,"href":"/product/process/relationships/overview"},{"title":"Single-record relationships","href":"/product/process/relationships/single-record"},{"title":"Multiple-records relationships","description":null,"href":"/product/process/relationships/multiple-records"},{"title":"Computed foreign keys","href":"/product/process/relationships/computed-fks"},{"title":"Under the hood","href":"/product/process/relationships/under-the-hood"}]},{"group":"Workflows","pages":[{"title":"Workflows","href":"/product/process/workflows/overview"},{"title":"Workflow triggers","href":"/product/process/workflows/triggers"},{"title":"Forest Runtime","href":"/product/process/workflows/forest-runtime"}]},{"group":"Advanced Concepts","pages":[{"title":"Hooks","href":"/product/process/advanced-concepts/hooks/overview"},{"group":"Plugins","pages":[{"title":"Plugins","href":"/product/process/advanced-concepts/plugins/overview"},{"title":"Active Storage","href":"/product/process/advanced-concepts/plugins/active-storage"},{"title":"Pylon plugins","href":"/product/process/advanced-concepts/plugins/pylon"},{"title":"Zendesk plugins","href":"/product/process/advanced-concepts/plugins/zendesk"}]},{"title":"Testing your back-end","href":"/product/process/advanced-concepts/testing"},{"group":"Developer Workflow","pages":[{"title":"Environments \u0026 branches","href":"/product/process/advanced-concepts/developer-workflow/environments-and-branches"},{"title":"Schema updates","href":"/product/process/advanced-concepts/developer-workflow/schema-updates"},{"title":"TypeScript setup \u0026 autocompletion","href":"/product/process/advanced-concepts/developer-workflow/typescript-setup"}]}]}]},{"group":"Build","pages":[{"title":"Layout editor","href":"/product/build/layout-editor"},{"title":"Collection configuration","href":"/product/build/collection-configuration"},{"group":"Workspaces","pages":[{"title":"Workspaces","href":"/product/build/workspaces"},{"title":"Example 1: KYC","href":"/product/build/workspaces/kyc"},{"title":"Example 2: Incident Management","href":"/product/build/workspaces/incident-management"}]},{"title":"Dashboards","href":"/product/manage/dashboards"},{"title":"Fields \u0026 widgets","href":"/product/build/fields-and-widgets/overview"},{"group":"Advanced Concepts","pages":[{"title":"Layout versioning","href":"/product/build/layout-versioning"},{"title":"Smart views","href":"/product/build/custom-views/smart-views"},{"title":"Search Configuration","href":"/product/build/search-configuration"},{"title":"Pagination Configuration","href":"/product/build/pagination"}]}]},{"group":"Execute","pages":[{"title":"Browsing \u0026 searching data","href":"/product/execute/browse"},{"title":"Executing actions","href":"/product/execute/actions"},{"title":"Executing workflows","href":"/product/execute/workflows"},{"title":"Export data","href":"/product/execute/export"}]},{"group":"Collaborate","pages":[{"title":"Approval workflows","href":"/product/collaborate/approval-workflows"},{"title":"Notes","href":"/product/collaborate/notes"}]},{"group":"Manage","pages":[{"title":"Team performance","href":"/product/manage/team-performance"},{"title":"Inbox","href":"/product/manage/inbox"},{"title":"Charts","href":"/product/manage/charts/overview"},{"title":"Smart Charts","href":"/product/manage/charts/smart-charts"}]},{"group":"Embed","pages":[{"title":"Forest MCP Server","href":"/product/embed/mcp-server"},{"title":"Forest Gateway","href":"/product/embed/gateway"},{"title":"Standalone Forest Gateway","href":"/product/embed/gateway-standalone"},{"title":"Zendesk App","href":"/product/embed/zendesk"},{"title":"n8n Node","href":"/product/embed/n8n"}]},{"group":"Control","pages":[{"title":"Roles \u0026 Permissions","href":"/get-started/control/roles-permissions"},{"title":"Teams","href":"/get-started/control/teams"},{"title":"Scopes","href":"/get-started/control/scopes-and-visibility"},{"title":"Audit \u0026 Activity Logs","href":"/get-started/control/audit"},{"title":"Audit Trail","href":"/get-started/control/audit-trail"},{"group":"Authentication","pages":[{"title":"Single Sign-On (SSO)","href":"/get-started/control/authentication/sso"},{"group":"SSO Providers","pages":[{"title":"SSO Provider Guides","href":"/get-started/control/authentication/sso-providers/overview"},{"title":"Google Workspace SSO","href":"/get-started/control/authentication/sso-providers/google"},{"title":"Okta SSO","href":"/get-started/control/authentication/sso-providers/okta"},{"title":"Azure AD / Entra ID SSO","href":"/get-started/control/authentication/sso-providers/azure"},{"title":"Generic SAML 2.0 SSO","href":"/get-started/control/authentication/sso-providers/generic-saml"}]},{"title":"Two-Factor Authentication (2FA)","href":"/get-started/control/authentication/2fa"},{"group":"SCIM Provisioning","pages":[{"title":"SCIM Integration with Okta","href":"/get-started/control/authentication/scim-okta"},{"title":"SCIM Integration with OneLogin","href":"/get-started/control/authentication/scim-onelogin"},{"title":"Manual SCIM Integration with Okta","href":"/get-started/control/authentication/scim-okta-manual"}]}]},{"group":"Security","pages":[{"title":"Security \u0026 Privacy Architecture","href":"/get-started/control/security/architecture"},{"title":"IP Whitelisting","href":"/get-started/control/security/ip-whitelisting"},{"title":"Auto Logout","href":"/get-started/control/security/auto-logout"},{"title":"Two-Factor Authentication Enforcement","href":"/get-started/control/security/2fa-enforcement"}]}]},{"group":"Project Settings","pages":[{"title":"General Settings","href":"/get-started/project-settings/general"},{"title":"User Management","href":"/get-started/project-settings/users"},{"title":"Service Accounts","href":"/get-started/project-settings/service-accounts"},{"title":"Interface \u0026 Branding","href":"/get-started/project-settings/interface"},{"title":"Billing \u0026 Invoices","href":"/get-started/project-settings/billing"}]}]},{"tab":"Reference","pages":[{"title":"Reference","href":"/reference/overview"}]},{"tab":"Legacy","pages":[{"title":"Legacy","href":"/legacy/agents-overview"}]}]},"title":"Single-record relationships - Forest Documentation","buildId":"dpl_cadrRc5H9XQiJQbDFN5mcYRs2PAj","deploymentId":"dpl_cadrRc5H9XQiJQbDFN5mcYRs2PAj","dynamics":[],"chunks":[]}