I am trying to use mongo DB for my MERN app. So far I have used SQL databases where database integrity has never been an issue.
But mongo being No-SQL does not support foreign key relation which is giving me a hard time.
One solution I could think of is to have a pre-save hook to check if the keys exist. Will that make the system too slow. Is there any other way to achieve this.
I tried using pre-save hooks, so far no issue. It’s just too much code to write in each model.