mongoose icon indicating copy to clipboard operation
mongoose copied to clipboard

Not work ObjectId.isValid function

Open inthedark122 opened this issue 11 years ago • 2 comments

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?

inthedark122 avatar Sep 11 '15 08:09 inthedark122

Automattic/mongoose#1959

inthedark122 avatar Sep 11 '15 08:09 inthedark122

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.

vkarpov15 avatar Sep 11 '15 13:09 vkarpov15