我只需要从该国家/地区集合中获取状态架构。 如何只采用状态模式?
var mongoose = require('mongoose');
var iterationsSchema = mongoose.Schema({
name : String,
effectiveFrom : {type : Date, default : new Date()},
active : {type: Boolean, default:true}
});
var citySchema = mongoose.Schema({
cityName:String,
iterations : [iterationsSchema],
active:{type:Boolean,default:true}
});
var StateSchema = mongoose.Schema({
stateName:String,
iterations : [iterationsSchema],
cities:[citySchema],
active:{type:Boolean,default:true}
});
var CountrySchema = mongoose.Schema({
countryName:String,
iterations : [iterationsSchema],
states:[StateSchema],
active:{type:Boolean,default:true}
});
var Country = mongoose.model('Country',CountrySchema);
module.exports = Country;