You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently having an issue with the model/scheme validation in case of a loadOneAndUpdate call.
Specifically, consider the normal create function, as in camo's examples, which obviously validates the input. I've added a quite strict model as well:
However, let's say I want to update the breed of a specified Dog entry. In this case, I would use the loadOneAndUpdate function since I want the other values to remain the same, and the create function obviously wouldn't work because of the missing name:
Note that the breed does not adhere to the model here. Yet, the document is actually updated with this invalid value.
To solve this issue, I guess loadOneAndUpdate would have to do some kind of validation. Perhaps additionally, an explicit validation function validate could be used and exposed which validates any given data against the model.
The text was updated successfully, but these errors were encountered:
I am currently having an issue with the model/scheme validation in case of a
loadOneAndUpdate
call.Specifically, consider the normal
create
function, as in camo's examples, which obviously validates the input. I've added a quite strict model as well:However, let's say I want to update the
breed
of a specified Dog entry. In this case, I would use theloadOneAndUpdate
function since I want the other values to remain the same, and thecreate
function obviously wouldn't work because of the missingname
:Note that the breed does not adhere to the model here. Yet, the document is actually updated with this invalid value.
To solve this issue, I guess
loadOneAndUpdate
would have to do some kind of validation. Perhaps additionally, an explicit validation functionvalidate
could be used and exposed which validates any given data against the model.The text was updated successfully, but these errors were encountered: