title: CastError: Cast to ObjectId failed for value "" at path "_id"
body: <p>Well, I see that here are a few posts like this, but they didn't help me ... </p>
  
  <p>let me describe my problem:</p>
  
  <p>I have two Schema's </p>
  
  <pre><code>var A = new Schema({
     someAttribut: {type: String},
     b: {type: ObjectId, ref:'B'}
  });
  
  var B = new Schema({
     someAttribut2: {type: Boolean, 'default': false'}
  });
  </code></pre>
  
  <p>Now I'm in the situation that I already have a B-Object and I want to create an A-Object.</p>
  
  <p>So i do it this way:</p>
  
  <pre><code>var a = new A(req.aFromClient); // {_id:null, someAttribute:'123', b:null}
  //load b from Database ... 
  a.b = existingBFromDatabase; // {_id: 'Sb~Õ5ÙÐDâb', someAttribute2: false}
  </code></pre>
  
  <p><em>The b object is loaded from my monogDB. The debugger shows me a valid ObjectId (53627ed535d9d04416e26218 or Sb~Õ5ÙÐDâb) for my b .</em></p>
  
  <p>But when I save my new A-Object, i get the error: <strong>'CastError: Cast to ObjectId failed for value "" at path "_id"'</strong></p>
  
  <p>I don't understand why I get this error. 
  Firstly, I don't define the id in the schema, so mongoose should add it, which seems to work. 
  Secondly, I think that mongoose should generate a new ID when I create an a object.</p>
  
  <p>do you have any proposal?</p>