Hi !
Before I try to code anything, what do you think about adding a validator for Mongodb's ObjectIDs ?
As Mongodb is widely used, it may be a good thing. But it may also be seen as a useless overhead.
Please take in account the fact that if #521 gets merged, this would become useless.
https://www.npmjs.com/package/joi-objectid might work for you
God. Thanks.
At the time, I was just checking in the _handler_ block, but it's gonna be cleaner now.
:tada:
(Gonna follow you, to say thanks once again)
Thanks! :smile:
The PR you mentioned won't be merged.
Sad.
Not if it's done in another way.
@Marsup is that a teaser for things to come?
We can use mongoose.Types.ObjectId.isValid for validating ObjectId is valid or not.
if (!mongoose.Types.ObjectId.isValid(req.body.id)) {
return res.status(400).send("Invalid object id");
}
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
Most helpful comment
We can use mongoose.Types.ObjectId.isValid for validating ObjectId is valid or not.