Defining the Product Schema

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: Number
26 });
27 mongoose.model('Product', ProductSchema);


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

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