Currently, I am familiarizing myself with KeystoneJS and attempting to showcase the many-to-many connections in the AdminUI.
I have established two models: playlist and trailer. Their many-to-many relationship is defined as follows:
models/Playlist.js
Playlist.add('Playlist', {
name: { type: Types.Text, initial: true, required: true, index: true, unique: true },
description: { type: Types.Textarea, initial: true, required: true },
}
);
Playlist.relationship({ ref: 'Trailer', refPath: 'title', path: 'trailers' });
models/Trailer.js
Trailer.add('Trailer', {
title: { type: Types.Text, required: true, initial: true, index: true },
playlists: { type: Types.Relationship, ref: 'Playlist', many: true },
}
)
The relationship has been correctly structured in MongoDB; there is an array of trailer ObjectID's stored in the playlist's trailers field. However, when viewing the Playlist in the AdminUI, it only displays "No related trailers..."
Why is this not functioning as expected? My goal is to visualize the relationship in the AdminUI.
The documentation regarding this functionality seems unhelpful. It consists of random code snippets without proper context. Despite following the example in Practical Keystone JS, I have not had any success.