how about error handling , i aint see nun ,
my replies model:
replies: {
require: true,
type: [
{
isReady: {
type: Boolean,
default: true,
},
creatorId: {
type: String,
required: true,
trim: true,
},
creator: {
type: String,
required: true,
trim: true,
},
body: {
type: String,
required: true,
trim: true,
min: [3, "Must be at least 6, got {VALUE}"],
},
timestamp: Number,
},
],
},
i tried this but still not getting any error if the body is empty or the creator
await PostModel.findOneAndUpdate(query, update, options, (err, doc) => {
// if (!err) return res.status(201).send(doc);
return res.status(400).send(err);
});