Joi validator with Mongo ObjectId.
npm i -s joi-oid
or
npm install joi-oid --save
joi-oid
verifies whether the value is suitable for the Mongo ObjectId type.
It is used like Joi
instead of Joi
. 🤔
const Joi = require('joi-oid')
const schema = Joi.object({
id: Joi.objectId(),
name: Joi.string(),
age: Joi.number().min(18),
})
MIT 🥰🤑