aalfiann / recachegoose

A Mongoose caching module that works exactly how you would expect it to, with the latest version of Mongoose.
https://nodei.co/npm/recachegoose
MIT License
26 stars 14 forks source link

recoverObjectId now recovers ObjectId for refs #3

Closed FullStack0verfl0w closed 2 years ago

aalfiann commented 3 years ago

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?

aalfiann commented 3 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
aalfiann commented 2 years ago

Thanks for the PR, I'll closed this because now is no longer match with the master branch..