title: Upsert not generating an ID
body: <p>So I've seen that many have had this issue, but all of them seem to be for an older driver version and the solutions aren't working for me. Basicaly, when I run <code>ReplaceOneAsync(...)</code> with a new object (no Id), it gets inserted, but with no ID. The most popular answer was to add <code>[BsonIgnoreIfDefault]</code> to the Id attribute of the document so that the serializer didn't think it was set, which is not working for me. Here's the base class:</p>
  
  <pre><code>[BsonIgnoreExtraElements(Inherited = true)]
  public abstract class MongoEntity : IMongoEntity
  {
      [BsonRepresentation(BsonType.ObjectId)]
      [BsonIgnoreIfDefault]
      public string Id { get; set; }
  }
  </code></pre>
  
  <p>And the upsert method:</p>
  
  <pre><code>public async Task&lt;T&gt; UpsertAsync(T entity)
  {
      var filter = Builders&lt;T&gt;.Filter.Eq(x =&gt; x.Id, entity.Id);
      await _collection.ReplaceOneAsync(
          filter,
          entity,
          new UpdateOptions { IsUpsert = true });
  
      return entity;
  }
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>MongoDB.Driver version 2.4.1.18</p>