bson-objectid

JSON →
library 2.0.4 ·javascript
verified Jun 5, 2026

Lightweight standalone ObjectID constructor compatible with MongoDB BSON ObjectID API. v2.0.4 is stable; releases are infrequent. Features zero-dependency creation and parsing of ObjectIDs without mongodb/bson driver — ideal for browser or server-side apps that need ObjectID generation/comparison but not full MongoDB client. Provides full API parity with official BSON ObjectID including createFromTime, createFromHexString, isValid, getTimestamp, and immutable instances. Ships TypeScript types. Supports ESM and CJS.