When I am viewing a ConversationTagValueSchema as related data for a Conversation, it shows the id as plain text rather than a link. All of these schemas are nested which is maybe the issue (ParticipantTagNameSchema is nested under a different collection)? I am using mongoose and flattenMode: ‘auto’
Failure Logs
Context
Project name: …
Team name: …
Environment name: …
Database type: …
Recent changes made on your end if any: …
And, if you are self-hosting your agent:
Agent technology: nodejs
Agent (forest package) name & version (from your .lock file):"
I have also tried adding references to the schema but when I do and try to load the record I get an error, “Cannot read properties of undefined (reading ‘collection’)”
Is there any work around for being able to click to the referred to record?
Can you also please share which of those schemas are defined as models?
Depending on this, there are many possibilities:
If ParticipantTagValueSchema, ParticipantTagNameSchema and ConversationTagValueSchema are models, you have to use the “ref” field.
If not, instead of using “ObjectId”, the correct schema type is preferred: participantTagValue: { type: ParticipantTagValueSchema, required: true }, participantTagName: { type: ParticipantTagNameSchema, required: true }
I am not sure why you say it is incorrect to have ObjectId. That is what is stored. If I do the schema then it will expect the full object not the Id. My models are you asking which are collections? None of them are. They are all schema that are nested in other collections which I assume is what makes this tricky. When I tried using “ref” for the collection that forest admin creates then I get the error, “Cannot read properties of undefined (reading ‘collection’)” when loading the page.
This type of relationship is not possible with MongoDB; relationships with MongoDB should target collections. It’s because it’s impossible to discover which document contains the sub-document you want to target.
Please consider a relational database to address this kind of relationship.
Otherwise, please explain in more detail what the expected result is on the UI, including the collections containing the shared schemas.