
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
payload-bidirectional-relationships-plugin
Advanced tools
plugin for Payload CMS, which enables bidirectional relationships
plugin for Payload CMS, which enables bidirectional relationships
:boom: :boom: :boom: works :100: with PayloadCMS version :two: and :three: :boom: :boom: :boom:
:bangbang: currently only works with MongoDB :bangbang:
[!NOTE]
You are currently in the v3 branch!
pnpm add payload-bidirectional-relationships-plugin@0.4.33-v3
[!WARNING]
Be aware to install only that version of this plugin which is compatible with the PayloadCMS version you are using! So if you are using PayloadCMS v2, there should be a '-v2' at the end instead of a '-v3' and vice versa. In the future, when this plugin becomes stable, there will be 2.x.x and 3.x.x versions.
import {biDirectionalRelationship} from 'payload-bidirectional-relationships-plugin'
export const relationAB = biDirectionalRelationship({
vertexA: {
anchor: 'collectionA.listA.fieldA',
// Options for the ArrayField 'listA'
listOptions: {
label: 'Relations to a document of Type B',
labels: {
singular: 'Relation to a document of Type B',
plural: 'Relations to a document of Type B'
}
},
// Options for the RelationshipField 'fieldA'
fieldOptions: {
label: 'Reference to a document of Type B'
}
},
vertexB: {
anchor: 'collectionB.listB.fieldB',
listOptions: {
label: 'Relations to a document of Type A',
labels: {
singular: 'Relation to a document of Type A',
plural: 'Relations to a document of Type A'
}
},
fieldOptions: {
label: 'Reference to a document of Type A'
}
},
/*
array of fields that will be display beneath each relation field;
each field is "part" of the relationship and describes it
*/
relationMeta: [
{
name: 'relationMeta',
type: 'text'
}
]
})
import {CollectionConfig} from 'payload/types'
import {relationAB} from './relationships'
export const CollectionA: CollectionConfig = {
slug: 'collectionA',
labels: {
singular: 'Document of Type A',
plural: 'Documents of Type A',
},
admin: {
useAsTitle: 'name',
},
fields: [
{
name: 'name',
type: 'text'
},
relationAB.anchors.collectionA
],
}
export const CollectionB: CollectionConfig = {
slug: 'collectionB',
labels: {
singular: 'Document of Type B',
plural: 'Documents of Type B',
},
admin: {
useAsTitle: 'name',
},
fields: [
{
name: 'name',
type: 'text'
},
relationAB.anchors.collectionB
],
}
import {buildConfig} from 'payload/config'
import {relationAB, /*...*/} from './relationships'
export default buildConfig({
//...,
plugins: [
//...,
biDirectionalRelationships([relationAB /*, ...*/])
]
})
FAQs
plugin for Payload CMS, which enables bidirectional relationships
The npm package payload-bidirectional-relationships-plugin receives a total of 0 weekly downloads. As such, payload-bidirectional-relationships-plugin popularity was classified as not popular.
We found that payload-bidirectional-relationships-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.