title: Mongoose Map of object array
body: <p>I'm learning mongodb and mongoose, and i can't figure out how to work with this schema :</p>
  
  <pre><code>mongoose.Schema({
    laps: {
      type: Map,
      of: [{type: ObjectId, ref:'Lap'}]
    }
  }, {collection: 'xxx'});
  </code></pre>
  
  <p>I've try to push the array like that :</p>
  
  <pre><code>this.laps.set(key, (this.laps.get(key)).push(mongoose.Types.ObjectId(newLap._id)));
  
  Map { '5bd1b3bfbef1001d64de6697' =&gt; ["5c0a3c0456be700670ed093b"] }
  </code></pre>
  
  <p>Each time i try to save the model i get this error:</p>
  
  <pre><code>validation failed: laps.5bd1b3bfbef1001d64de6697: Cast to [ObjectId] failed for value "[1]" at path "laps.$*"
  </code></pre>
  
  <p>And i'm stuck there</p>