ObjectId.isValid() returns true for non-object IDs

How can I determine that a mongodb Object ID is valid? Using the ObjectId.isValid() method from the mongodb nodejs package isn’t enough, it returns true for any string that contains 12 characters. More so, I think this is a bug so how can I report this to the mongodb maintainers? The github repo has disabled issues.

1 Like

Hi @Uchechukwu_Ozoemena,

Did you end up reporting an issue for this?

Per the Bugs/Feature Requests section of the README in this GitHub repo, the NODE project in MongoDB JIra is the appropriate place to report issues directly to the library maintainers. It would be helpful to include more details on your use case, the level of validation you are expecting, and the version of the library you are using.