associations validation
ahmedsoliman64 opened this issue · comments
ahmedsoliman64 commented
**No validation to make sure that associations already exist **
Create new model with ref to other model not validated if already exist or not
To Reproduce
Steps to reproduce the behavior:
- Create two models A and B.
2- Add ref in model A of type ObjectId to model B
3- try to call the post method to create new document from model A with a random ObjectId value in the ref field. which refer to model B.
Expected behavior
a validation errors with message Model B is not exist
Actual behavior
Error 500 will be thrown
Justin Headley commented
@ahmedsoliman64 Thanks for pointing this out!