@@ -274,9 +274,9 @@ public void Drop()
274274 /// <summary>
275275 /// Asynchronously drops the collection from the database.
276276 /// </summary>
277- public async Task DropAsync ( )
277+ public Task DropAsync ( )
278278 {
279- await _database . DropCollectionAsync ( _collectionName ) . ConfigureAwait ( false ) ;
279+ return _database . DropCollectionAsync ( _collectionName ) ;
280280 }
281281
282282 public T FindOne ( )
@@ -754,10 +754,9 @@ public Task<T> FindOneAndUpdateAsync(Filter<T> filter, UpdateBuilder<T> update,
754754
755755 /// <inheritdoc cref="FindOneAndUpdateAsync(Filter{T}, UpdateBuilder{T}, FindOneAndUpdateOptions{T})"/>
756756 /// <param name="commandOptions"></param>
757- public async Task < T > FindOneAndUpdateAsync ( Filter < T > filter , UpdateBuilder < T > update , FindOneAndUpdateOptions < T > updateOptions , CommandOptions commandOptions )
757+ public Task < T > FindOneAndUpdateAsync ( Filter < T > filter , UpdateBuilder < T > update , FindOneAndUpdateOptions < T > updateOptions , CommandOptions commandOptions )
758758 {
759- var response = await FindOneAndUpdateAsync < T > ( filter , update , updateOptions , commandOptions , false ) . ConfigureAwait ( false ) ;
760- return response ;
759+ return FindOneAndUpdateAsync < T > ( filter , update , updateOptions , commandOptions , false ) ;
761760 }
762761
763762 /// <summary>
@@ -807,10 +806,9 @@ public Task<TResult> FindOneAndUpdateAsync<TResult>(Filter<T> filter, UpdateBuil
807806
808807 /// <inheritdoc cref="FindOneAndUpdateAsync{TResult}(Filter{T}, UpdateBuilder{T}, FindOneAndUpdateOptions{T})"/>
809808 /// <param name="commandOptions"></param>
810- public async Task < TResult > FindOneAndUpdateAsync < TResult > ( Filter < T > filter , UpdateBuilder < T > update , FindOneAndUpdateOptions < T > updateOptions , CommandOptions commandOptions )
809+ public Task < TResult > FindOneAndUpdateAsync < TResult > ( Filter < T > filter , UpdateBuilder < T > update , FindOneAndUpdateOptions < T > updateOptions , CommandOptions commandOptions )
811810 {
812- var response = await FindOneAndUpdateAsync < TResult > ( filter , update , updateOptions , commandOptions , false ) . ConfigureAwait ( false ) ;
813- return response ;
811+ return FindOneAndUpdateAsync < TResult > ( filter , update , updateOptions , commandOptions , false ) ;
814812 }
815813
816814 internal async Task < TResult > FindOneAndUpdateAsync < TResult > ( Filter < T > filter , UpdateBuilder < T > update , FindOneAndUpdateOptions < T > updateOptions , CommandOptions commandOptions , bool runSynchronously )
@@ -869,10 +867,9 @@ public Task<T> FindOneAndReplaceAsync(T replacement, ReplaceOptions<T> replaceOp
869867
870868 /// <inheritdoc cref="FindOneAndReplaceAsync(T, ReplaceOptions{T})"/>
871869 /// <param name="commandOptions"></param>
872- public async Task < T > FindOneAndReplaceAsync ( T replacement , ReplaceOptions < T > replaceOptions , CommandOptions commandOptions )
870+ public Task < T > FindOneAndReplaceAsync ( T replacement , ReplaceOptions < T > replaceOptions , CommandOptions commandOptions )
873871 {
874- var response = await FindOneAndReplaceAsync < T > ( null , replacement , replaceOptions , commandOptions , false ) . ConfigureAwait ( false ) ;
875- return response ;
872+ return FindOneAndReplaceAsync < T > ( null , replacement , replaceOptions , commandOptions , false ) ;
876873 }
877874
878875 /// <summary>
@@ -922,10 +919,9 @@ public Task<TResult> FindOneAndReplaceAsync<TResult>(T replacement, ReplaceOptio
922919
923920 /// <inheritdoc cref="FindOneAndReplaceAsync{TResult}(T, ReplaceOptions{T})"/>
924921 /// <param name="commandOptions"></param>
925- public async Task < TResult > FindOneAndReplaceAsync < TResult > ( T replacement , ReplaceOptions < T > replaceOptions , CommandOptions commandOptions )
922+ public Task < TResult > FindOneAndReplaceAsync < TResult > ( T replacement , ReplaceOptions < T > replaceOptions , CommandOptions commandOptions )
926923 {
927- var response = await FindOneAndReplaceAsync < TResult > ( null , replacement , replaceOptions , commandOptions , false ) . ConfigureAwait ( false ) ;
928- return response ;
924+ return FindOneAndReplaceAsync < TResult > ( null , replacement , replaceOptions , commandOptions , false ) ;
929925 }
930926
931927 /// <summary>
@@ -976,10 +972,9 @@ public Task<T> FindOneAndReplaceAsync(Filter<T> filter, T replacement, ReplaceOp
976972
977973 /// <inheritdoc cref="FindOneAndReplaceAsync(Filter{T}, T, ReplaceOptions{T})"/>
978974 /// <param name="commandOptions"></param>
979- public async Task < T > FindOneAndReplaceAsync ( Filter < T > filter , T replacement , ReplaceOptions < T > replaceOptions , CommandOptions commandOptions )
975+ public Task < T > FindOneAndReplaceAsync ( Filter < T > filter , T replacement , ReplaceOptions < T > replaceOptions , CommandOptions commandOptions )
980976 {
981- var response = await FindOneAndReplaceAsync < T > ( filter , replacement , replaceOptions , commandOptions , false ) . ConfigureAwait ( false ) ;
982- return response ;
977+ return FindOneAndReplaceAsync < T > ( filter , replacement , replaceOptions , commandOptions , false ) ;
983978 }
984979
985980 /// <summary>
@@ -1035,10 +1030,9 @@ public Task<TResult> FindOneAndReplaceAsync<TResult>(Filter<T> filter, T replace
10351030 /// The FindOneAndReplace alternatives that accept a TResult type parameter allow for deserializing the resulting document
10361031 /// as a different type (most commonly used when using projection to return a subset of fields)
10371032 /// </remarks>
1038- public async Task < TResult > FindOneAndReplaceAsync < TResult > ( Filter < T > filter , T replacement , ReplaceOptions < T > replaceOptions , CommandOptions commandOptions )
1033+ public Task < TResult > FindOneAndReplaceAsync < TResult > ( Filter < T > filter , T replacement , ReplaceOptions < T > replaceOptions , CommandOptions commandOptions )
10391034 {
1040- var response = await FindOneAndReplaceAsync < TResult > ( filter , replacement , replaceOptions , commandOptions , false ) . ConfigureAwait ( false ) ;
1041- return response ;
1035+ return FindOneAndReplaceAsync < TResult > ( filter , replacement , replaceOptions , commandOptions , false ) ;
10421036 }
10431037
10441038 internal async Task < TResult > FindOneAndReplaceAsync < TResult > ( Filter < T > filter , T replacement , ReplaceOptions < T > replaceOptions , CommandOptions commandOptions , bool runSynchronously )
@@ -1075,7 +1069,7 @@ public ReplaceResult ReplaceOne(Filter<T> filter, T replacement, ReplaceOptions<
10751069 public ReplaceResult ReplaceOne ( Filter < T > filter , T replacement , ReplaceOptions < T > replaceOptions , CommandOptions commandOptions )
10761070 {
10771071 var response = ReplaceOneAsync ( filter , replacement , replaceOptions , commandOptions , true ) . ResultSync ( ) ;
1078- return response . Result ;
1072+ return response ;
10791073 }
10801074
10811075 /// <summary>
@@ -1099,20 +1093,19 @@ public Task<ReplaceResult> ReplaceOneAsync(Filter<T> filter, T replacement, Repl
10991093
11001094 /// <inheritdoc cref="ReplaceOneAsync(Filter{T}, T, ReplaceOptions{T})"/>
11011095 /// <param name="commandOptions"></param>
1102- public async Task < ReplaceResult > ReplaceOneAsync ( Filter < T > filter , T replacement , ReplaceOptions < T > replaceOptions , CommandOptions commandOptions )
1096+ public Task < ReplaceResult > ReplaceOneAsync ( Filter < T > filter , T replacement , ReplaceOptions < T > replaceOptions , CommandOptions commandOptions )
11031097 {
1104- var response = await ReplaceOneAsync ( filter , replacement , replaceOptions , commandOptions , false ) . ConfigureAwait ( false ) ;
1105- return response . Result ;
1098+ return ReplaceOneAsync ( filter , replacement , replaceOptions , commandOptions , false ) ;
11061099 }
11071100
1108- internal async Task < ApiResponseWithStatus < ReplaceResult > > ReplaceOneAsync ( Filter < T > filter , T replacement , ReplaceOptions < T > replaceOptions , CommandOptions commandOptions , bool runSynchronously )
1101+ internal async Task < ReplaceResult > ReplaceOneAsync ( Filter < T > filter , T replacement , ReplaceOptions < T > replaceOptions , CommandOptions commandOptions , bool runSynchronously )
11091102 {
11101103 replaceOptions . Filter = filter ;
11111104 replaceOptions . Replacement = replacement ;
11121105 replaceOptions . Projection = new ExclusiveProjectionBuilder < T > ( ) . Exclude ( "*" ) ;
11131106 var command = CreateCommand ( "findOneAndReplace" ) . WithPayload ( replaceOptions ) . AddCommandOptions ( commandOptions ) ;
11141107 var response = await command . RunAsyncReturnStatus < ReplaceResult > ( runSynchronously ) . ConfigureAwait ( false ) ;
1115- return response ;
1108+ return response . Result ;
11161109 }
11171110
11181111 /// <summary>
@@ -1630,7 +1623,7 @@ public UpdateResult UpdateOne(Filter<T> filter, UpdateBuilder<T> update, UpdateO
16301623 public UpdateResult UpdateOne ( Filter < T > filter , UpdateBuilder < T > update , UpdateOneOptions < T > updateOptions , CommandOptions commandOptions )
16311624 {
16321625 var response = UpdateOneAsync ( filter , update , updateOptions , commandOptions , true ) . ResultSync ( ) ;
1633- return response . Result ;
1626+ return response ;
16341627 }
16351628
16361629 /// <summary>
@@ -1675,19 +1668,18 @@ public Task<UpdateResult> UpdateOneAsync(Filter<T> filter, UpdateBuilder<T> upda
16751668
16761669 /// <inheritdoc cref="UpdateOneAsync(Filter{T}, UpdateBuilder{T}, UpdateOneOptions{T})"/>
16771670 /// <param name="commandOptions"></param>
1678- public async Task < UpdateResult > UpdateOneAsync ( Filter < T > filter , UpdateBuilder < T > update , UpdateOneOptions < T > updateOptions , CommandOptions commandOptions )
1671+ public Task < UpdateResult > UpdateOneAsync ( Filter < T > filter , UpdateBuilder < T > update , UpdateOneOptions < T > updateOptions , CommandOptions commandOptions )
16791672 {
1680- var response = await UpdateOneAsync ( filter , update , updateOptions , commandOptions , false ) . ConfigureAwait ( false ) ;
1681- return response . Result ;
1673+ return UpdateOneAsync ( filter , update , updateOptions , commandOptions , false ) ;
16821674 }
16831675
1684- internal async Task < ApiResponseWithStatus < UpdateResult > > UpdateOneAsync ( Filter < T > filter , UpdateBuilder < T > update , UpdateOneOptions < T > updateOptions , CommandOptions commandOptions , bool runSynchronously )
1676+ internal async Task < UpdateResult > UpdateOneAsync ( Filter < T > filter , UpdateBuilder < T > update , UpdateOneOptions < T > updateOptions , CommandOptions commandOptions , bool runSynchronously )
16851677 {
16861678 updateOptions . Filter = filter ;
16871679 updateOptions . Update = update ;
16881680 var command = CreateCommand ( "updateOne" ) . WithPayload ( updateOptions ) . AddCommandOptions ( commandOptions ) ;
16891681 var response = await command . RunAsyncReturnStatus < UpdateResult > ( runSynchronously ) . ConfigureAwait ( false ) ;
1690- return response ;
1682+ return response . Result ;
16911683 }
16921684
16931685 /// <summary>
@@ -1715,7 +1707,7 @@ public UpdateResult UpdateMany(Filter<T> filter, UpdateBuilder<T> update, Update
17151707 public UpdateResult UpdateMany ( Filter < T > filter , UpdateBuilder < T > update , UpdateManyOptions < T > updateOptions , CommandOptions commandOptions )
17161708 {
17171709 var response = UpdateManyAsync ( filter , update , updateOptions , commandOptions , false ) . ResultSync ( ) ;
1718- return response . Result ;
1710+ return response ;
17191711 }
17201712
17211713 /// <summary>
@@ -1738,13 +1730,12 @@ public Task<UpdateResult> UpdateManyAsync(Filter<T> filter, UpdateBuilder<T> upd
17381730
17391731 /// <inheritdoc cref="UpdateManyAsync(Filter{T}, UpdateBuilder{T}, UpdateManyOptions{T})"/>
17401732 /// <param name="commandOptions"></param>
1741- public async Task < UpdateResult > UpdateManyAsync ( Filter < T > filter , UpdateBuilder < T > update , UpdateManyOptions < T > updateOptions , CommandOptions commandOptions )
1733+ public Task < UpdateResult > UpdateManyAsync ( Filter < T > filter , UpdateBuilder < T > update , UpdateManyOptions < T > updateOptions , CommandOptions commandOptions )
17421734 {
1743- var response = await UpdateManyAsync ( filter , update , updateOptions , commandOptions , false ) . ConfigureAwait ( false ) ;
1744- return response . Result ;
1735+ return UpdateManyAsync ( filter , update , updateOptions , commandOptions , false ) ;
17451736 }
17461737
1747- internal async Task < ApiResponseWithStatus < UpdateResult > > UpdateManyAsync ( Filter < T > filter , UpdateBuilder < T > update , UpdateManyOptions < T > updateOptions , CommandOptions commandOptions , bool runSynchronously )
1738+ internal async Task < UpdateResult > UpdateManyAsync ( Filter < T > filter , UpdateBuilder < T > update , UpdateManyOptions < T > updateOptions , CommandOptions commandOptions , bool runSynchronously )
17481739 {
17491740 updateOptions . Filter = filter ;
17501741 updateOptions . Update = update ;
@@ -1767,7 +1758,7 @@ internal async Task<ApiResponseWithStatus<UpdateResult>> UpdateManyAsync(Filter<
17671758 keepProcessing = false ;
17681759 }
17691760 }
1770- return new ApiResponseWithStatus < UpdateResult > ( ) { Result = updateResult } ;
1761+ return updateResult ;
17711762 }
17721763
17731764 /// <summary>
@@ -1780,10 +1771,10 @@ public DocumentsCountResult CountDocuments()
17801771 }
17811772
17821773 /// <summary>
1783- /// Synchronous version of <see cref="CountDocumentsAsync(CommandOptions )"/>
1774+ /// Synchronous version of <see cref="CountDocumentsAsync(CountDocumentsCommandOptions )"/>
17841775 /// </summary>
17851776 /// <inheritdoc cref="CountDocumentsAsync(CommandOptions)"/>
1786- public DocumentsCountResult CountDocuments ( CommandOptions commandOptions )
1777+ public DocumentsCountResult CountDocuments ( CountDocumentsCommandOptions commandOptions )
17871778 {
17881779 return CountDocumentsAsync ( null , commandOptions , true ) . ResultSync ( ) ;
17891780 }
@@ -1802,7 +1793,7 @@ public Task<DocumentsCountResult> CountDocumentsAsync()
18021793 /// </summary>
18031794 /// <param name="commandOptions"></param>
18041795 /// <returns></returns>
1805- public Task < DocumentsCountResult > CountDocumentsAsync ( CommandOptions commandOptions )
1796+ public Task < DocumentsCountResult > CountDocumentsAsync ( CountDocumentsCommandOptions commandOptions )
18061797 {
18071798 return CountDocumentsAsync ( null , commandOptions , false ) ;
18081799 }
@@ -1817,10 +1808,10 @@ public DocumentsCountResult CountDocuments(Filter<T> filter)
18171808 }
18181809
18191810 /// <summary>
1820- /// Synchronous version of <see cref="CountDocumentsAsync(Filter{T}, CommandOptions )"/>
1811+ /// Synchronous version of <see cref="CountDocumentsAsync(Filter{T}, CountDocumentsCommandOptions )"/>
18211812 /// </summary>
1822- /// <inheritdoc cref="CountDocumentsAsync(Filter{T}, CommandOptions )"/>
1823- public DocumentsCountResult CountDocuments ( Filter < T > filter , CommandOptions commandOptions )
1813+ /// <inheritdoc cref="CountDocumentsAsync(Filter{T}, CountDocumentsCommandOptions )"/>
1814+ public DocumentsCountResult CountDocuments ( Filter < T > filter , CountDocumentsCommandOptions commandOptions )
18241815 {
18251816 return CountDocumentsAsync ( filter , commandOptions , true ) . ResultSync ( ) ;
18261817 }
@@ -1837,12 +1828,12 @@ public Task<DocumentsCountResult> CountDocumentsAsync(Filter<T> filter)
18371828
18381829 /// <inheritdoc cref="CountDocumentsAsync(Filter{T}"/>
18391830 /// <param name="commandOptions"></param>
1840- public Task < DocumentsCountResult > CountDocumentsAsync ( Filter < T > filter , CommandOptions commandOptions )
1831+ public Task < DocumentsCountResult > CountDocumentsAsync ( Filter < T > filter , CountDocumentsCommandOptions commandOptions )
18411832 {
18421833 return CountDocumentsAsync ( filter , commandOptions , false ) ;
18431834 }
18441835
1845- internal async Task < DocumentsCountResult > CountDocumentsAsync ( Filter < T > filter , CommandOptions commandOptions , bool runSynchronously )
1836+ internal async Task < DocumentsCountResult > CountDocumentsAsync ( Filter < T > filter , CountDocumentsCommandOptions commandOptions , bool runSynchronously )
18461837 {
18471838 var findOptions = new DocumentFindOptions < T > ( )
18481839 {
0 commit comments