System Schema Definition
System Schema
serves as a foundational sub-schema, designed to incorporate essential system fields into various documents throughout the project. It’s a pivotal part of the schema structure, ensuring consistency and reliability in tracking the state and lifecycle of documents.
System Schema
includes the following fields:
createdAt & modifiedAt
These fields are automatically generated and managed by Mongoose when the schema is defined with the following configuration:
archived & archivedAt
These fields are optional and can be used to track the state of a document. They are not automatically managed by Mongoose and must be set manually. The archived
field is a boolean that indicates whether the document is archived. The archivedAt
field is a date that indicates when the document was archived.
It’s important to note that the archival logic is considered and managed from the Generic Crud Client.