category: {
type: ObjectId,
ref: "Category",
required: [true, "Recipe must belong to a category"],
},
But if a category isn’t selected, the message I get is:
Recipe validation failed: category: Cast to ObjectId failed for value "" (type string) at path "category" because of "BSONError"
Why do I not get my custom error message?