When you use Mongoose, you often need to implement schemas. A schema defines the fields and field types for documents in a collection. This can be very useful if your data is structured to support a schema because you can validate and typecast objects to match the requirements of the schema.
For each field in a schema, you need to define a specific value type. These value types are supported:
String
Number
Boolean
or Bool
Array
Buffer
Date
ObjectId
or Oid
Mixed
A schema needs to be defined for each different document type that you plan to use. Also, you should store only one document type in each collection.