title: Mongoose objectId is not saving in another collection
body: <p>I am new to mongoose and nodejs. Please help me to understand what is wrong in my code while saving collection. My user.js looks like below</p>
  
  <pre><code>var mongoose = require('mongoose');
  var Schema = mongoose.Schema;
  var bcrypt = require('bcrypt-nodejs');
  
  var UserSchema = new Schema ({
  name: { type: String, required: true },
  username:{ type:String, required: true, index:{ unique: true}},
  password:{ type: String, required: true, select: false},
  email:{ type: String, required: true, select: true},
  mobile:{ type: String, required: true, select: true},
  nativecid:{ type: Schema.Types.ObjectId, ref:'City'},
  regdate:{ type: Date, default: Date.now },
  did:{ type: String, required: false }
  });
  
  UserSchema.pre('save', function(next){
  
  var user = this;
  
  if(!user.isModified('password')) return next();
  bcrypt.hash(user.password, null, null, function(err, hash){
  if(err) return next(err);
  user.password = hash;
  next();
  });
  });
  
  UserSchema.methods.comparePassword = function(password){
  var user = this;
  return bcrypt.compareSync(password, user.password);
  };
  
  module.exports = mongoose.model('User', UserSchema);
  </code></pre>
  
  <p>And my City model ie city.js looks like below</p>
  
  <pre><code>var mongoose = require('mongoose');
  
  var Schema = mongoose.Schema;
  
  var CitySchema = new Schema({
  name: { type: String, required: true },
  status: { type: Boolean, default: true },
  date: { type: Date, default: Date.now }
  });
  
  module.exports = mongoose.model( 'City', CitySchema );
  </code></pre>
  
  <p>City is already stored in database as below</p>
  
  <pre><code>{ "_id" : ObjectId("56a4a0adb0f445561cfd4e37"), "name" : "New York", "date" : ISODate("2016-01-24T10:00:13.220Z"), "status" : 1, "__v" : 0 }
  </code></pre>
  
  <p>I want this ObjectId of New York should be saved in user collection while user signups. I am trying like below but not succeed.</p>
  
  <pre><code>var User = require('../models/user');
  var City = require('../models/city');
  
  api.post('/signup', function(req, res){
  
      var user = new User({
          name: req.body.name,
          username: req.body.username,
          password: req.body.password,
          email: req.body.email,
          mobile: req.body.mobile
       });
       City
          .findOne({ name: "New York" })
          .populate('_id') 
          .exec(function (err, city1) {
          if(err){
              res.send(err);
              return;
          }
          console.log('The creator is %s', city1.name);
        return user.nativecid = city1._id;
  
      })   
  
      user.save(function(err){
          if(err){
              res.send(err);
              return;
          }
  
          res.json({
              success: true,
              message: 'User created successfully!'
          });
      });
  });
  </code></pre>
  
  <p>I am not understanding what is wrong. Please advice me.</p>