Since IMongoCollection<T>.InsertOneAsync(...)
returns no value (except the awaitable
Task
), and its documentation says nothing about exceptions, how can I be sure that the new record was added and no error has happened?
IMongoCollection<RecordType> batch = recordsBatchFactory.Create();
RecordType newRecord = makeNewRecord();
await batch.InsertOneAsync(newRecord);
// is newRecord guaranteed to be in the DB at this point?