Refs :
Introducing the 2.0 .NET Driver
I tried to implement :
public class Repository
{
public static async Task Insert()
{
var client = new MongoClient("mongodb://localhost:27017");
var database = client.GetDatabase("foo");
var collection = database.GetCollection<BsonDocument>("bar");
var document = new BsonDocument { { "_id", 1 }, { "x", 2 } };
await collection.InsertOneAsync(document);
}
}
static void Main(string[] args)
{
Task tsk = Repository.Insert();
Console.WriteLine("State: " + tsk.Status);
}
Result : WaitingForActivation. Nothing changed in database. Please help me!