Schema design
-
MongoDB
Mongoose Schema Types Explained With Examples
A Mongoose schema lists each field and its type: String, Number, Boolean, Date, Schema.Types.ObjectId for references, arrays like [String], nested schemas for subdocuments, Map for dynamic keys, Decimal128 for money and Mixed for anything. Add options such as required, default, enum, min, max and match to validate data before it is saved.

