Skip to main content
The Deno 2 Release Candidate is here
Learn more
Latest
method Bson.ObjectId.isValid
Re-export
import { Bson } from "https://deno.land/x/model@v1.2/dependencies/mongo.ts";
const { ObjectId } = Bson;

Checks if a value is a valid bson ObjectId

Parameters

id:
| string
| number
| Uint8Array
  • ObjectId instance to validate.

Returns

boolean