public async Task UpsertAsync(UserDocument document) { var options = new FindOneAndReplaceOptions <UserDocument, UserDocument> { IsUpsert = true }; await _dbContext.Users.FindOneAndReplaceAsync <UserDocument>(d => d.Id == document.Id, document, options); }
public void Upsert(UserDocument document) { var options = new FindOneAndReplaceOptions <UserDocument, UserDocument> { IsUpsert = true }; _dbContext.Users.FindOneAndReplace <UserDocument>(d => d.Id == document.Id, document, options); }
public async Task <Guid> AddAsync(UserDocument document) { await _dbContext.Users.InsertOneAsync(document); return(document.Id); }
public Guid Add(UserDocument document) { _dbContext.Users.InsertOne(document); return(document.Id); }