Feature(s) impacted
Hello,
I am trying to migrate smart relationship from forest-express-mongoose v9 to forestadmin/agent.
I want to have a smart field reference to other collection and following this v9 document
collection('config', {
actions: [],
fields: [
{
field: 'user',
type: 'String',
reference: 'users',
isReadOnly: true,
get: async (config) => {
const user = await findById(config.f_id.user_id);
return user;
},
async search(search) {
const user = await findById(search);
if (user == null) return;
const fRecords = await fService.find({ user_id: user._id }, { _id: 1 });
const fIds = fRecords.map((f) => f._id);
return { f_id: { $in: fIds } };
},
},
],
});
In new document I see reference
has been removed. Is there a way I can create relationship for smart field.
I tried to add relationship but got error Column not found: 'config.user'
which make sense that config collection mongoose schema doesn’t have user
.
Observed behavior
Expected behavior
Failure Logs
Context
- Project name: OrthograhIQ
- Team name: …
- Environment name: dev
- Agent technology: nodejs
- Agent (forest package) name & version:
- forestadmin/agent 1.40.0
- forestadmin/datasource-mongoose 1.7.6
- Database type: mongo