For instance, I have schema of Device where field passcode is Joi.string.require(). Now I want to get objects from corresponding collection but do not need all the fields. Let's say I want only get _id, name, lastSeen. So I am calling it like:
await Device.find(someQuery, Device.fieldAdapter('_id name lastSeen'))
This call throws an exception with Joi validation message child "passcode" fails because ["passcode" is required].
Yep, that all makes sense. I'm not sure this is considered a bug though. It's not possible to fulfill all those requirements and have schema validation.
For instance, I have schema of
Device
where fieldpasscode
isJoi.string.require()
. Now I want to get objects from corresponding collection but do not need all the fields. Let's say I want only get_id, name, lastSeen
. So I am calling it like:This call throws an exception with Joi validation message
child "passcode" fails because ["passcode" is required]
.Looks like bug for me.