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 }
03 var AddressSchema = new Schema({
04 name: String,
05 address: String,
06 city: String,
07 state: String,
08 zip: String
09 }, { _id: false });
10 mongoose.model('Address', AddressSchema);