stdlib/src/common/utils/mdbid/README.md at main · webiny/stdlib · GitHub
Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 548 Bytes

README.md

File metadata and controls

25 lines (17 loc) · 548 Bytes
name mdbid
description Generates MongoDB-compatible ObjectId strings via bson-objectid.
context common

mdbid

Generates MongoDB-compatible ObjectId strings. Uses bson-objectid to produce 24-character, time-sortable, globally unique hex identifiers that match MongoDB's native ObjectId format.

API

function mdbid(): string;

Returns a 24-character lowercase hex string (e.g. "507f1f77bcf86cd799439011").

Usage

import { mdbid } from "@webiny/stdlib";

const id = mdbid(); // "507f1f77bcf86cd799439011"