Generates short, URL-friendly IDs from MongoDB ObjectIds by extracting timestamp and counter bits (77 bits total). The generated IDs are one-way (cannot be reversed to original ObjectId) but are reasonably unique. Version 1.0.1 is the only version; package is small and has no dependencies. Unlike other short ID libraries (e.g., nanoid, uuid), this is specifically designed for MongoDB ObjectIds and does not generate random IDs.
npm install di-short-mongo-idNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to generate lowercase and uppercase short IDs from MongoDB ObjectId strings.
Ensure you store the original ObjectId if you need to reverse the mapping.
Consider combining with a unique prefix if generating IDs across distributed systems.
Check for alternatives or consider if this still meets your needs.
Use `const shortId = require('di-short-mongo-id')` (CommonJS) or `import shortId from 'di-short-mongo-id'` (ESM).Do not destructure; the entire module is a function. Use `const shortId = require('di-short-mongo-id')`.Run `npm install di-short-mongo-id` in your project root.
No dependency data recorded yet.