public async Task <UpdateResult> PatchAttribute(ICallistoUpdate <Person> update) { IClientSessionHandle session = await StartSessionAsync(update); UpdateResult result = await Operators.Update.One(update); await session.CommitTransactionAsync(); EndSession(update); return(result); }
/// <summary> /// Update many documents at once. /// </summary> /// <param name="operation">Instance of class implementing <see cref="ICallistoUpdate{TEntity}" /></param> /// <exception cref="NullCallistoOperationException">When command is null</exception> /// <exception cref="NullUpdateDefinitionException">When command <see cref="UpdateDefinition{TDocument}" /> is null</exception> /// <exception cref="NullFilterDefinitionException">When command <see cref="FilterDefinition{TDocument}" /> is null</exception> /// <returns> /// <see cref="UpdateResult" /> /// </returns> public async Task <UpdateResult> Many(ICallistoUpdate <T> operation) { Helper.PreExecutionCheck(operation); if (operation.ClientSessionHandle is null) { return(await _collection.UpdateManyAsync(operation.FilterDefinition, operation.UpdateDefinition, operation.UpdateOptions, operation.CancellationToken).ConfigureAwait(false)); } return(await _collection.UpdateManyAsync(operation.ClientSessionHandle, operation.FilterDefinition, operation.UpdateDefinition, operation.UpdateOptions, operation.CancellationToken).ConfigureAwait(false)); }