Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilize ObjectId.isValid method #1

Open
DemianParkhomenko opened this issue Mar 16, 2024 · 1 comment
Open

Utilize ObjectId.isValid method #1

DemianParkhomenko opened this issue Mar 16, 2024 · 1 comment

Comments

@DemianParkhomenko
Copy link

export class ObjectIdValidationRule implements Rule {

static isValid(id: number | string | ObjectId | Buffer | ObjectIdLike): boolean {

https://github.com/mongodb/js-bson/blob/d685aa5a19db2ef67824b99847a380af4fa6bfe0/src/objectid.ts#L301

The current validator does not cover all cases to validate ObjectId. MongoDB provides method to validate ids

@vird
Copy link

vird commented Mar 17, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants