I am using the C# driver 2.0. I have a POCO that I am storing in mongo that looks like this:
public class TestObject
{
[BsonId]
public Guid Id { get; set; }
public string Property1 { get; set; }
}
I am storing the object using a generic method like this:
public async void Insert<T>(T item)
{
var collection = GetCollection<T>();
await collection.InsertOneAsync(item);
}
I would like to have a similar method to Update an object. However, the ReplaceOneAsync
method requires a filter be specified.
I would like to simply update the same object, based on whatever the [BsonId]
property is. Any one know if this is possible?