June 2014
Intermediate to advanced
696 pages
38h 52m
English
You begin by defining an address schema that will be generic so that it can be used in the shipping information and as part of the billing information. Listing 28.1 implements AddressSchema, which contains the standard address information. Notice that the following code is used to disable the _id property since you do not need to look up addresses by ID:
{ _id: false }
Listing 28.1 cart_model.js-AddressSchema: Defining an address schema for shipping and billing
03 var AddressSchema = new Schema({04 name: String,05 address: String,06 city: String,07 state: String,08 zip: String09 }, { _id: false });10 mongoose.model('Address', AddressSchema);
Read now
Unlock full access