title: Mongoose - ObjectId failed for value "[object Object]" at path "states"
body: <p>I am receiving a cast error to ObjectId and I really cannot see why:</p>
  
  <p><strong><em>CastError: Cast to ObjectId failed for value "[object Object]" at path "states"</em></strong></p>
  
  <blockquote>
  <pre><code>  var data = require('../../../data/seed/refs/countries/countries.json');
      model.Super_CountryRefs.find({}).exec(function (err, collection) {
          if (collection.length === 0) {
              data.forEach(function (country) {
                  var countryModel = new model.Super_CountryRefs;
                  var country_id = mongoose.Types.ObjectId();
                  countryModel._id = country_id;
                  countryModel.name = country.name;
                  countryModel.abbr = country.abbr;
                  countryModel.code = country.code;
                  countryModel.flag = country.flag;
                  if(country.states != undefined){
                      if(country.states.length &gt; 0){
                          country.states.forEach(function(state){
                              console.log('State: ' + state.name)
                              var stateModel = new model.Super_StateProvinceRefs;
                              stateModel.name = state.name;
                              stateModel.abbr = state.abbr;
  EXCEPTION BEING THROWN HERE --&gt; stateModel.country = countryModel._id;
                              stateModel.save(function(err){
                                  if(err){
                                      console.log('Error: ' + err)
                                  } else {
                                      countryModel.states.push(state)
                                  }
                              })
                          })
                      }
                  }
  
                  countryModel.save(function(err){
                      if(err)
                          console.log('Error: ' + err);
                  })
              })
              console.log('Country/State Seed Complete');
          }
      });
  </code></pre>
  </blockquote>
  
  <p><strong>My States Model:</strong></p>
  
  <pre><code>        country: {
          type: Schema.ObjectId,
          ref: 'SuperCountry',
          required: 'Country is required'
      }
  </code></pre>
  
  <p><strong>My Country Model:</strong>  </p>
  
  <pre><code>    states : [{
          type: Schema.ObjectId,
          ref: 'SuperStateProvinceRefs'
  }]
  </code></pre>
  
  <p>To make matters more strange, the data is populated, and correctly, in the database. Can anyone see why I am getting the error? </p>