could somebody tell me why this code not working ? It compiles, it runs but the Mongo database is still empty. It is working when doing it synchronously.
class Program
{
static void Main(string[] args)
{
var client = new MongoClient();
var db = client.GetDatabase("Mongo");
var collection = db.GetCollection<User>("Users");
User user = new User("Denis", "Chang", "China", 21);
AddUserAsync(user, collection);
}
static async void AddUserAsync(User user, IMongoCollection<User> collection)
{
await collection.InsertOneAsync(user);
}
}