title: When I use ReplaceOneAsync and IsUpsert = true mongodb add's a null Id. How do I stop this?
body: <p>I am able to update a Document if the Document Exists using the Following</p>
  <pre><code>var filter = Builders&lt;Neighborhood&gt;.Filter.Eq(x =&gt; x.Id, neighborhood.Id);
  
  var result = await collection.ReplaceOneAsync(filter,
               neighborhood,new UpdateOptions { IsUpsert = true });
  
  
  [CollectionName(&quot;neighborhoods&quot;)]
  [BsonIgnoreExtraElements(true)]
  public class Neighborhood : IEntity&lt;string&gt;
  {
   [BsonId(IdGenerator = typeof(GuidGenerator))]
   [BsonRepresentation(BsonType.ObjectId)]
   public string Id { get; set; }
  
   [BsonElement(&quot;name&quot;)]
   public string  Name    { get; set; }
  }
  </code></pre>
  <p>How do Insert a Document if the Id = NULL and I want to return the updated result.</p>
  <p>When Inserting a New Document <code>NULL</code> ID, A Record is created with a <code>NULL</code> Id, I added  <code>[BsonId(IdGenerator = typeof(GuidGenerator))]</code> without any luck.</p>
  <p>What am I doing wrong so a <code>ObjectId</code> can be generated for new records.</p>