SomeId:string | number | bigint | boolean | Date | UUID | ObjectId | null
All possible types for a document ID. JSON scalar types, Date, UUID, and ObjectId.
Note that the _idcan technically be null. Trying to set the _id to null doesn't mean "auto-generate
an ID" like it may in some other databases; it quite literally means "set the ID to null".
It's heavily recommended to properly type this in your Schema, so you know what to expect for your _id field.
All possible types for a document ID. JSON scalar types,
Date,UUID, andObjectId.Note that the
_idcan technically benull. Trying to set the_idtonulldoesn't mean "auto-generate an ID" like it may in some other databases; it quite literally means "set the ID tonull".It's heavily recommended to properly type this in your Schema, so you know what to expect for your
_idfield.