@just-in/core
Version:
A TypeScript-first framework for building adaptive digital health interventions.
15 lines • 640 B
TypeScript
import * as mongoDB from 'mongodb';
/**
* Safely converts a string to a MongoDB `ObjectId`.
*
* This function attempts to create an `ObjectId` from a given string `id`.
* If the conversion fails, it logs an error indicating an invalid format
* and returns `null` instead of throwing an exception.
*
* @param id - The string to convert into a MongoDB `ObjectId`.
*
* @returns The created `ObjectId` if the conversion is successful;
* otherwise, returns `null` if the `id` format is invalid.
*/
export declare const toObjectId: (id: string | null | undefined) => mongoDB.ObjectId | null;
//# sourceMappingURL=mongo.helpers.d.ts.map