Closed FullStack0verfl0w closed 2 years ago
Are you sure with regex /^[0-9a-fA-F]{24}$/
?
Well any custom 24 character string that has numbers and letters in, i.e.
123Aabbccddeeff789012345678901234
will also match. So your solution still not accurate.
Remember that we are able to create custom ObjectId, i.e:
new mongoose.Types.ObjectId('wwwxxxyyyzzz');
// then we try to validate it
const ObjectId = mongoose.Types.ObjectId;
ObjectId.isValid('wwwxxxyyyzzz'); // 12 char string also return true
Thanks for the PR, I'll closed this because now is no longer match with the master branch..
Sorry late to respon your PR coz quite bit busy in the real job.
Thanks, I really apreciate your PR but could you provide a test scenario?