0

I need to take only state schema from this country collection. How do I take only state schema?

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;
sanyassh
  • 8,100
  • 13
  • 36
  • 70
Prakash
  • 306
  • 5
  • 18

0 Answers0