Skip to content

bad problem with ObjectId.isValid() #3823

@ORESoftware

Description

@ORESoftware

I am having a helluva a time trying to determining if a value is a valid ObjectId, there seems to be a big problem with this -

I tried

var ObjectId = mongoose.Types.ObjectId;
var ObjectId = mongoose.Schema.Types.ObjectId;

using ObjectId.isValid() and new ObjectId(val);

take a look here:

you can see that the value "95" or 95 slips through:

filter
screenshot 2016-01-29 20 04 30

map
screenshot 2016-01-29 20 04 48

what the heck is going on?
please help, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThis issue is a user-facing general improvement that doesn't fix a bug or add a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions