Serializes a MongoDB document or any nested structure containing
MongoDB-specific types. This function handles ObjectId and Date objects,
converting them to strings and ISO strings respectively. It also recursively
processes nested objects and arrays.
Parameters
doc:
unknown
The document or value to serialize. Can be of any type.
Returns unknown
The serialized version of the input. ObjectIds are converted to strings, Dates to
ISO strings, and nested objects/arrays are recursively processed.
Serializes a MongoDB document or any nested structure containing MongoDB-specific types. This function handles ObjectId and Date objects, converting them to strings and ISO strings respectively. It also recursively processes nested objects and arrays.