June 2014
Intermediate to advanced
696 pages
38h 52m
English
Next, you define the schema to store product information. The product model for this example is a print with name, imagefile, description, price, and instock counters. Listing 28.3 shows the full definition of ProductSchema.
Listing 28.3 cart_model.js-ProductSchema: Defining a basic product schema for prints
20 var ProductSchema = new Schema({21 name: String,22 imagefile: String,23 description: String,24 price: Number,25 instock: Number26 });27 mongoose.model('Product', ProductSchema);
Read now
Unlock full access