We know that embedded documents work better in MongoDB. I don’t want to lose the benefits of reference while taking advantage of this. For this, I want to apply both reference and embedded approaches together.
For example: Let’s say I have both car and engine document. I want to link them together, but not as a reference. I still want to manually update/delete at the same time.
What is the most logical way to do this? So far I’ve tried Smart Relationship and I’m looking for an easier way.
Also, should I use smart fields if I want to select from a list of engines when adding cars? this requires a lot of manual work. Because I have too many relationships in my project
Thank you.
Hey @Melis_Tekin, and welcome to our community
I’m guessing that you are currently using forest-express-mongoose
your agent, is that correct?
We do provide a feature called fields flattenner
for mongoose (Documentation is available here) that may be helpful in your case.
If you are using @forestadmin/mongoose-datasource
, then maybe the following documentation could lead to potential solution.
Let me know if that helps.
1 Like
Thank you for your answer. I didn’t pay attention to this feature.
When adding cars with Flatten I can’t detect pre-added documents in engine collection. Is there any way to detect this?
1 Like
Could you give me more details about the document itself, as well as the behavior you are having vs the behavior you are expecting?
Thanks in advance