title: How to automatically create a referenced child doc when the parent doc is created?
body: <p>I have models like below:</p>
  
  <pre><code>var GameSchema = new Schema({
      players: [{type: Schema.Types.ObjectId, ref: 'Player'}], 
  });
  
  var PlayerSchema = new Schema({
      name: {
          type: String,
          required: true
      }
  });
  mongoose.model('Player', PlayerSchema); 
  mongoose.model('Game', GameSchema); 
  </code></pre>
  
  <p>Here's my code:</p>
  
  <pre><code>var p1 = new Player({name: 'abc'});
  var p2 = new Player({name: 'def'});
  var agame = new Game({players:[p1,p2]});
  agame.save();
  </code></pre>
  
  <p>What I'm trying to do is when the new game is created in db, the p1, p2 player should also be created. my code doesn't work, p1,p2 is not saved. How can I achieve that?</p>