Generates short, URL-safe IDs from MongoDB ObjectIds using timestamp and counter components. Version 0.1.1 is a legacy package with no recent updates. Unlike base64 encoding, it produces compact alphanumeric strings but is one-way and should not be used for security or high-uniqueness requirements. Lightweight with zero dependencies.
npm install short-mongo-idNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Converts a MongoDB ObjectId string into a short alphanumeric ID. Works with any valid ObjectId.
If you need to reverse, store the mapping separately.
Consider using nanoid or uuid with a custom transformation for modern needs.
Do not rely on this for primary keys or security tokens.
Validate ObjectId before passing: use /^[a-f\d]{24}$/i.test(id).Use `import shortId from 'short-mongo-id'` or `const shortId = require('short-mongo-id')`.Ensure the input is a 24-character hex string representing a MongoDB ObjectId.
Run `npm install short-mongo-id`.
No dependency data recorded yet.