@@ -19,9 +19,9 @@ import type {
19
19
OptionalUnlessRequiredId ,
20
20
TODO_NODE_3286 ,
21
21
UpdateFilter ,
22
+ WithId ,
22
23
WithoutId
23
24
} from './mongo_types' ;
24
- import { WithId } from './mongo_types' ;
25
25
import type { AggregateOptions } from './operations/aggregate' ;
26
26
import { BulkWriteOperation } from './operations/bulk_write' ;
27
27
import type { IndexInformationOptions } from './operations/common_functions' ;
@@ -822,12 +822,17 @@ export class Collection<TSchema extends Document = Document> {
822
822
*/
823
823
async findOneAndDelete (
824
824
filter : Filter < TSchema > ,
825
- options ? : FindOneAndDeleteOptions & { returnRawResult : false }
825
+ options : FindOneAndDeleteOptions & { returnRawResult : false }
826
826
) : Promise < ModifyResult < TSchema > > ;
827
827
async findOneAndDelete (
828
828
filter : Filter < TSchema > ,
829
- options ? : FindOneAndDeleteOptions & { returnRawResult : true | undefined }
829
+ options : FindOneAndDeleteOptions & { returnRawResult : true }
830
830
) : Promise < WithId < TSchema > | null > ;
831
+ async findOneAndDelete (
832
+ filter : Filter < TSchema > ,
833
+ options : FindOneAndDeleteOptions
834
+ ) : Promise < WithId < TSchema > | null > ;
835
+ async findOneAndDelete ( filter : Filter < TSchema > ) : Promise < WithId < TSchema > | null > ;
831
836
async findOneAndDelete (
832
837
filter : Filter < TSchema > ,
833
838
options ?: FindOneAndDeleteOptions
@@ -858,16 +863,16 @@ export class Collection<TSchema extends Document = Document> {
858
863
filter : Filter < TSchema > ,
859
864
replacement : WithoutId < TSchema > ,
860
865
options : FindOneAndReplaceOptions & { returnRawResult : true }
861
- ) : Promise < WithId < TSchema > > ;
866
+ ) : Promise < WithId < TSchema > | null > ;
862
867
async findOneAndReplace (
863
868
filter : Filter < TSchema > ,
864
869
replacement : WithoutId < TSchema > ,
865
870
options : FindOneAndReplaceOptions
866
- ) : Promise < WithId < TSchema > > ;
871
+ ) : Promise < WithId < TSchema > | null > ;
867
872
async findOneAndReplace (
868
873
filter : Filter < TSchema > ,
869
874
replacement : WithoutId < TSchema >
870
- ) : Promise < WithId < TSchema > > ;
875
+ ) : Promise < WithId < TSchema > | null > ;
871
876
async findOneAndReplace (
872
877
filter : Filter < TSchema > ,
873
878
replacement : WithoutId < TSchema > ,
@@ -894,17 +899,26 @@ export class Collection<TSchema extends Document = Document> {
894
899
async findOneAndUpdate (
895
900
filter : Filter < TSchema > ,
896
901
update : UpdateFilter < TSchema > ,
897
- options ?: FindOneAndReplaceOptions & { returnRawResult : false }
902
+ options : FindOneAndUpdateOptions & { returnRawResult : false }
898
903
) : Promise < ModifyResult < TSchema > > ;
899
904
async findOneAndUpdate (
900
905
filter : Filter < TSchema > ,
901
906
update : UpdateFilter < TSchema > ,
902
- options ?: FindOneAndReplaceOptions & { returnRawResult : true | undefined }
903
- ) : Promise < WithId < TSchema > > ;
907
+ options : FindOneAndUpdateOptions & { returnRawResult : true }
908
+ ) : Promise < WithId < TSchema > | null > ;
904
909
async findOneAndUpdate (
905
910
filter : Filter < TSchema > ,
906
911
update : UpdateFilter < TSchema > ,
907
- options ?: FindOneAndReplaceOptions
912
+ options : FindOneAndUpdateOptions
913
+ ) : Promise < WithId < TSchema > | null > ;
914
+ async findOneAndUpdate (
915
+ filter : Filter < TSchema > ,
916
+ update : UpdateFilter < TSchema >
917
+ ) : Promise < WithId < TSchema > | null > ;
918
+ async findOneAndUpdate (
919
+ filter : Filter < TSchema > ,
920
+ update : UpdateFilter < TSchema > ,
921
+ options ?: FindOneAndUpdateOptions
908
922
) : Promise < WithId < TSchema > | ModifyResult < TSchema > | null > {
909
923
return executeOperation (
910
924
this . client ,
0 commit comments