June 2014
Intermediate to advanced
696 pages
38h 52m
English
To define a schema for model, you need to create a new instance of a Schema object. The Schema object definition accepts an object that describes the schema as the first parameter and an options object as the second parameter:
new Schema(definition, options)
The options object defines the interaction with the collection on the MongoDB server. Table 16.1 lists the options that are most commonly used.
Table 16.1 Options that can be specified when defining a Schema object
For example, to create a schema for a collection called students, with a name field that is a String type, an average ...
Read now
Unlock full access