We have complex relationships between the two collections, i.e., “Companies” & “Consumers.”
Companies schema
{
...
'applicationId': String,
'users': [{ type: Mongoose.Schema.Types.ObjectId, ref: 'consumers'}],
}
Consumer schema
{
...
'applicationId': String,
}
By just this much, I was not able to create the relationship then. I tried another method by adding this code to forest “companies” fields,
{
field: 'users',
type: [Object],
ref: 'consumers',
reference: 'consumers.applicationId',
}
Still, this didn’t solve then. I manually added the route for the APIs that forest was calling when getting all consumers for an application. Still, by doing this, when I navigated to consumers’ tabs, initially, all fields were empty.