mongoose
mongoose copied to clipboard
Not work ObjectId.isValid function
When I check valid ObjectId
> console.log(mongoose.Types.ObjectId.isValid('[email protected]'));
true
I get result true. But if I execute this query then I have error. Why is this happening?
Automattic/mongoose#1959
https://github.com/mongodb/js-bson/issues/112 as well. Any 12 character string is technically a valid mongodb objectid under the hood, however, mongoose casting doesn't handle that case. I'll open up a separate issue, #3365, to track this.