Thank you for writing this, I find your library to be super helpful!
ISSUE
Upon execution of your example, I get the following error:
ReferenceError: Schema is not defined
I was not able to locate your definition/import of Schema in your code.
CODE
// custom validation function checking value for a regex
const checkHexColor = val => {
return /^#[0-9a-fA-F]$/.test(val)
}
const car = new Schema({
color: {
type: String,
use: { checkHexColor }
}
})