title: Update MongoDB collection where field doesn't exist
body: <p>I want to update every record in a collection that doesn't contain a particular field. </p>
  
  <p>The following query works using Mongo shell, but I am struggling to write this using the mongoDB.Driver in .Net.</p>
  
  <pre><code>db.Comments.update(
      { MemberRoleType: { $exists: false }},
      { $set: { MemberRoleType: 4 },
      { multi: true }
  )
  </code></pre>
  
  <p>I've attempted various methods such as follows but can't achieve the result I'm looking for :</p>
  
  <pre><code>await comments.UpdateManyAsync(c =&gt; c.MemberRoleType == 0, Builders&lt;Comment&gt;.Update.Set(x =&gt; x.MemberRoleType, ContentRoleType.Online)));
  </code></pre>