Defining a Schema

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:

Image String

Image Number

Image Boolean or Bool

Image Array

Image Buffer

Image Date

Image ObjectId or Oid

Image 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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.253.62