title: MONGO DB UpdateOne WriteError
body: <p>I am using the <a href="https://docs.mongodb.com/manual/tutorial/getting-started/" rel="nofollow noreferrer">https://docs.mongodb.com/manual/tutorial/getting-started/</a> to get started with Mongo. </p>
  
  <p>But while trying to update a record i face an issue.</p>
  
  <p>The commands I have tried are :</p>
  
  <pre><code>    db.studentenrolment.insertMany([{"_id":11111111,"name":"Mary Smith","contactInfo":{"address":"20/1 Princess Highway, Caulfield East, VIC , 3145","phone":"0411111222     ","email":"msmith@monash.edu"},"enrolmentInfo":[{"unitcode":"FIT1004","year":"2013","semester":1,"mark":65,"grade":"C "},{"unitcode":"FIT1040","year":"2013","semester":2,"mark":74,"grade":"D "},{"unitcode":"FIT1040","year":"2013","semester":1,"mark":45,"grade":"N "},{"unitcode":"FIT2077","year":"2013","semester":2,"mark":74,"grade":"D "}]},
  {"_id":11111115,"name":"David Dumbledore","contactInfo":{"address":"1 Queen Avenue, Caulfield East, VIC , 3145","phone":"0411111666     ","email":"dsmith@monash.edu"},"enrolmentInfo":[{"unitcode":"FIT2077","year":"2013","semester":2,"mark":45,"grade":"N "},{"unitcode":"FIT1040","year":"2013","semester":1,"mark":80,"grade":"HD"}]},
  {"_id":11111116,"name":"John Chung","contactInfo":{"address":"12/1 Princess Highway, Caulfield East, VIC , 3145","phone":"0411111777     ","email":"jchung@monash.edu"},"enrolmentInfo":[{"unitcode":"FIT1004","year":"2013","semester":2,"mark":65,"grade":"C "},{"unitcode":"FIT1040","year":"2013","semester":2,"mark":80,"grade":"HD"}]}])
  
  db.studentenrolment.update({"_id":11111111},{$push:{"enrolmentInfo"
  :{"unitcode":"FIT2001","year":"2013","semester":2,"mark":0,"grade":
  "-"}}})
  </code></pre>
  
  <p>The query fails here:</p>
  
  <pre><code>db.studentenrolment.updateOne (
  {"_id":11111111,
  "enrolmentInfo.unitcode":"FIT2001"}, 
  {
  $set:
  {"enrolmentInfo.mark" : 87, "enrolmentInfo.grade" : "HD"
  }
  } )
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>WriteError@src/mongo/shell/bulk_api.js:458:48
  Bulk/mergeBatchResults@src/mongo/shell/bulk_api.js:855:49
  Bulk/executeBatch@src/mongo/shell/bulk_api.js:919:13
  Bulk/this.execute@src/mongo/shell/bulk_api.js:1163:21
  DBCollection.prototype.insertOne@src/mongo/shell/crud_api.js:580:17
  @(shell):1:1
  </code></pre>