Closed francisrod01 closed 6 years ago
Hey Francis.
It's not current supported that way. You can try to use other schemas though:
import { schema as userSchema } from "../user/model";
import { schema as locationSchema } from "../location/model";
body({
user: userSchema.tree,
location: locationSchema.tree
});
I'm not sure if that works as I've never used that approach. Let me know if it works for you. :)
I hope it will be supported soon.
For the moment, I'm using body({ location: { type: Object } })
.
Hi there! A have a question about
mongoose
and pre validate.Is it possible to pre validate the request using Mongoose and bodymen and
schema.tree
with reference other collection as a field? . I need to validate the "user" and "location" fields.The company model:
In the
location
field, if I POST a JSON object, it process like that:And shows me an error as below: