title: In mongodb how do you do a pure update (not upsert) to replace an entire typed document?
body: <p>I am trying to implement our CRUD interface using the C# MongoDB Driver. Our update method is supposed to throw an error if the record (with the same id as the passed-in model) does not exist.</p>
  
  <ul>
  <li><p>I know MongoCollection.Save can update a document based on the id,
  but it will also insert. I do not want to insert under any
  circumstances.</p></li>
  <li><p>I also want to avoid manually forming an update by specifying every
  member.</p></li>
  <li><p>I also want to avoid calling the mongo database twice E.g.;</p>
  
  <ol>
  <li>Check if the document exisits.</li>
  <li>Save if it does exist.</li>
  </ol></li>
  </ul>
  
  <p>I am looking for something as close as possible to this:</p>
  
  <pre><code>var result = myCollection.Update(myModel, WriteConcern.Acknowledged);
  //result will have an error if a document with Id==myModel.Id did not pre-exist
  </code></pre>
  
  <p>I would also be happy with somthing akin to:</p>
  
  <pre><code>var query = Query&lt;MyModel&gt;.EQ(m =&gt; m.Id, myModel.Id);
  var update = Update&lt;MyModel&gt;.SetDocument(myModel);
  var result = myCollection.Update(query, update, WriteConcern.Acknowledged);
  </code></pre>
  
  <p>Is there a 'proper' way to do this? If not, what mind-boggling alternative pattern to 'CRUD my models' am I supposed to use with Mongo DB?</p>
  
  <p>Is there something I can set in MongoInsertOptions to achieve this (btw, if you create your own MongoInsertOptions, how do you initialize it with the defaults which would normally be used)?</p>
  
  <p>Is there some hack way to do it?</p>
  
  <p>Thank you.</p>