@@ -67,47 +67,6 @@ schema.pre('init', function() {
67
67
expectType < HydratedDocument < IDocument > > ( this ) ;
68
68
} ) ;
69
69
70
- schema . post ( 'init' , function ( res ) {
71
- expectType < HydratedDocument < IDocument > > ( this ) ;
72
- expectNotType < Query < any , any > > ( res ) ;
73
- } ) ;
74
-
75
- schema . pre ( 'init' , { document : true , query : false } , function ( ) {
76
- expectType < HydratedDocument < IDocument > > ( this ) ;
77
- } ) ;
78
-
79
- schema . post ( 'init' , { document : true , query : false } , function ( res ) {
80
- expectType < HydratedDocument < IDocument > > ( this ) ;
81
- expectNotType < Query < any , any > > ( res ) ;
82
- } ) ;
83
-
84
- schema . pre ( 'init' , { document : true , query : true } , function ( ) {
85
- expectType < HydratedDocument < IDocument > > ( this ) ;
86
- } ) ;
87
-
88
- schema . post ( 'init' , { document : true , query : true } , function ( res ) {
89
- expectType < HydratedDocument < IDocument > > ( this ) ;
90
- expectNotType < Query < any , any > > ( res ) ;
91
- } ) ;
92
-
93
- schema . pre ( 'init' , { document : false , query : true } , function ( ) {
94
- expectType < never > ( this ) ;
95
- } ) ;
96
-
97
- schema . post ( 'init' , { document : false , query : true } , function ( res ) {
98
- expectType < never > ( this ) ;
99
- expectNotType < Query < any , any > > ( res ) ;
100
- } ) ;
101
-
102
- schema . pre ( 'init' , { document : false , query : false } , function ( ) {
103
- expectType < never > ( this ) ;
104
- } ) ;
105
-
106
- schema . post ( 'init' , { document : false , query : false } , function ( res ) {
107
- expectType < never > ( this ) ;
108
- expectNotType < Query < any , any > > ( res ) ;
109
- } ) ;
110
-
111
70
schema . pre ( 'estimatedDocumentCount' , function ( ) {
112
71
expectType < Query < any , any > > ( this ) ;
113
72
} ) ;
@@ -693,51 +652,6 @@ schema.post('deleteOne', { document: false, query: false }, function(res) {
693
652
expectNotType < Query < any , any > > ( res ) ;
694
653
} ) ;
695
654
696
- schema . pre ( [ 'save' , 'init' ] , function ( ) {
697
- expectType < HydratedDocument < IDocument > > ( this ) ;
698
- } ) ;
699
-
700
- schema . post ( [ 'save' , 'init' ] , function ( res ) {
701
- expectType < HydratedDocument < IDocument > > ( this ) ;
702
- expectNotType < Query < any , any > > ( res ) ;
703
- } ) ;
704
-
705
- schema . pre ( [ 'save' , 'init' ] , { document : true , query : false } , function ( ) {
706
- expectType < HydratedDocument < IDocument > > ( this ) ;
707
- } ) ;
708
-
709
- schema . post ( [ 'save' , 'init' ] , { document : true , query : false } , function ( res ) {
710
- expectType < HydratedDocument < IDocument > > ( this ) ;
711
- expectNotType < Query < any , any > > ( res ) ;
712
- } ) ;
713
-
714
- schema . pre ( [ 'save' , 'init' ] , { document : true , query : true } , function ( ) {
715
- expectType < HydratedDocument < IDocument > > ( this ) ;
716
- } ) ;
717
-
718
- schema . post ( [ 'save' , 'init' ] , { document : true , query : true } , function ( res ) {
719
- expectType < HydratedDocument < IDocument > > ( this ) ;
720
- expectNotType < Query < any , any > > ( res ) ;
721
- } ) ;
722
-
723
- schema . pre ( [ 'save' , 'init' ] , { document : false , query : true } , function ( ) {
724
- expectType < never > ( this ) ;
725
- } ) ;
726
-
727
- schema . post ( [ 'save' , 'init' ] , { document : false , query : true } , function ( res ) {
728
- expectType < never > ( this ) ;
729
- expectNotType < Query < any , any > > ( res ) ;
730
- } ) ;
731
-
732
- schema . pre ( [ 'save' , 'init' ] , { document : false , query : false } , function ( ) {
733
- expectType < never > ( this ) ;
734
- } ) ;
735
-
736
- schema . post ( [ 'save' , 'init' ] , { document : false , query : false } , function ( res ) {
737
- expectType < never > ( this ) ;
738
- expectNotType < Query < any , any > > ( res ) ;
739
- } ) ;
740
-
741
655
schema . pre ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' ] , function ( ) {
742
656
expectType < Query < any , any > > ( this ) ;
743
657
} ) ;
@@ -828,137 +742,137 @@ schema.post(['estimatedDocumentCount', 'countDocuments', 'deleteMany', 'distinct
828
742
expectNotType < Query < any , any > > ( res ) ;
829
743
} ) ;
830
744
831
- schema . pre ( [ 'save ' , 'init ' , 'updateOne' , 'deleteOne' , 'validate' ] , function ( ) {
745
+ schema . pre ( [ 'estimatedDocumentCount ' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany ', 'updateOne' , 'deleteOne' , 'validate' ] , function ( ) {
832
746
expectType < Query < any , any > | HydratedDocument < IDocument > > ( this ) ;
833
747
} ) ;
834
748
835
- schema . post ( [ 'save ' , 'init ' , 'updateOne' , 'deleteOne' , 'validate' ] , function ( res ) {
749
+ schema . post ( [ 'estimatedDocumentCount ' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany ', 'updateOne' , 'deleteOne' , 'validate' ] , function ( res ) {
836
750
expectType < Query < any , any > | HydratedDocument < IDocument > > ( this ) ;
837
751
expectNotType < Query < any , any > > ( res ) ;
838
752
} ) ;
839
753
840
- schema . pre ( [ 'save ' , 'init ' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : false , query : true } , function ( ) {
754
+ schema . pre ( [ 'estimatedDocumentCount ' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany ', 'updateOne' , 'deleteOne' , 'validate' ] , { document : false , query : true } , function ( ) {
841
755
expectType < Query < any , any > > ( this ) ;
842
756
} ) ;
843
757
844
- schema . post ( [ 'save ' , 'init ' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : false , query : true } , function ( res ) {
758
+ schema . post ( [ 'estimatedDocumentCount ' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany ', 'updateOne' , 'deleteOne' , 'validate' ] , { document : false , query : true } , function ( res ) {
845
759
expectType < Query < any , any > > ( this ) ;
846
760
expectNotType < Query < any , any > > ( res ) ;
847
761
} ) ;
848
762
849
- schema . pre ( [ 'save ' , 'init ' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : true , query : false } , function ( ) {
763
+ schema . pre ( [ 'estimatedDocumentCount ' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany ', 'updateOne' , 'deleteOne' , 'validate' ] , { document : true , query : false } , function ( ) {
850
764
expectType < HydratedDocument < IDocument > > ( this ) ;
851
765
} ) ;
852
766
853
- schema . post ( [ 'save ' , 'init ' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : true , query : false } , function ( res ) {
767
+ schema . post ( [ 'estimatedDocumentCount ' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany ', 'updateOne' , 'deleteOne' , 'validate' ] , { document : true , query : false } , function ( res ) {
854
768
expectType < HydratedDocument < IDocument > > ( this ) ;
855
769
expectNotType < Query < any , any > > ( res ) ;
856
770
} ) ;
857
771
858
- schema . pre ( [ 'save ' , 'init ' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : true , query : true } , function ( ) {
772
+ schema . pre ( [ 'estimatedDocumentCount ' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany ', 'updateOne' , 'deleteOne' , 'validate' ] , { document : true , query : true } , function ( ) {
859
773
expectType < Query < any , any > | HydratedDocument < IDocument > > ( this ) ;
860
774
} ) ;
861
775
862
- schema . post ( [ 'save ' , 'init ' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : true , query : true } , function ( res ) {
776
+ schema . post ( [ 'estimatedDocumentCount ' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany ', 'updateOne' , 'deleteOne' , 'validate' ] , { document : true , query : true } , function ( res ) {
863
777
expectType < Query < any , any > | HydratedDocument < IDocument > > ( this ) ;
864
778
expectNotType < Query < any , any > > ( res ) ;
865
779
} ) ;
866
780
867
- schema . pre ( [ 'save ' , 'init ' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : false , query : false } , function ( ) {
781
+ schema . pre ( [ 'estimatedDocumentCount ' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany ', 'updateOne' , 'deleteOne' , 'validate' ] , { document : false , query : false } , function ( ) {
868
782
expectType < never > ( this ) ;
869
783
} ) ;
870
784
871
- schema . post ( [ 'save ' , 'init ' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : false , query : false } , function ( res ) {
785
+ schema . post ( [ 'estimatedDocumentCount ' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany ', 'updateOne' , 'deleteOne' , 'validate' ] , { document : false , query : false } , function ( res ) {
872
786
expectType < never > ( this ) ;
873
787
expectNotType < Query < any , any > > ( res ) ;
874
788
} ) ;
875
789
876
- schema . pre ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , 'updateOne' , 'deleteOne' , 'validate' ] , function ( ) {
790
+ schema . pre ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , 'save' , ' updateOne', 'deleteOne' , 'validate' ] , function ( ) {
877
791
expectType < Query < any , any > | HydratedDocument < IDocument > > ( this ) ;
878
792
} ) ;
879
793
880
- schema . post ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , 'updateOne' , 'deleteOne' , 'validate' ] , function ( res ) {
794
+ schema . post ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , 'save' , ' updateOne', 'deleteOne' , 'validate' ] , function ( res ) {
881
795
expectType < Query < any , any > | HydratedDocument < IDocument > > ( this ) ;
882
796
expectNotType < Query < any , any > > ( res ) ;
883
797
} ) ;
884
798
885
- schema . pre ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : false , query : true } , function ( ) {
799
+ schema . pre ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , 'save' , ' updateOne', 'deleteOne' , 'validate' ] , { document : false , query : true } , function ( ) {
886
800
expectType < Query < any , any > > ( this ) ;
887
801
} ) ;
888
802
889
- schema . post ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : false , query : true } , function ( res ) {
803
+ schema . post ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , 'save' , ' updateOne', 'deleteOne' , 'validate' ] , { document : false , query : true } , function ( res ) {
890
804
expectType < Query < any , any > > ( this ) ;
891
805
expectNotType < Query < any , any > > ( res ) ;
892
806
} ) ;
893
807
894
- schema . pre ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : true , query : false } , function ( ) {
808
+ schema . pre ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , 'save' , ' updateOne', 'deleteOne' , 'validate' ] , { document : true , query : false } , function ( ) {
895
809
expectType < HydratedDocument < IDocument > > ( this ) ;
896
810
} ) ;
897
811
898
- schema . post ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : true , query : false } , function ( res ) {
812
+ schema . post ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , 'save' , ' updateOne', 'deleteOne' , 'validate' ] , { document : true , query : false } , function ( res ) {
899
813
expectType < HydratedDocument < IDocument > > ( this ) ;
900
814
expectNotType < Query < any , any > > ( res ) ;
901
815
} ) ;
902
816
903
- schema . pre ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : true , query : true } , function ( ) {
817
+ schema . pre ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , 'save' , ' updateOne', 'deleteOne' , 'validate' ] , { document : true , query : true } , function ( ) {
904
818
expectType < Query < any , any > | HydratedDocument < IDocument > > ( this ) ;
905
819
} ) ;
906
820
907
- schema . post ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : true , query : true } , function ( res ) {
821
+ schema . post ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , 'save' , ' updateOne', 'deleteOne' , 'validate' ] , { document : true , query : true } , function ( res ) {
908
822
expectType < Query < any , any > | HydratedDocument < IDocument > > ( this ) ;
909
823
expectNotType < Query < any , any > > ( res ) ;
910
824
} ) ;
911
825
912
- schema . pre ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : false , query : false } , function ( ) {
826
+ schema . pre ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , 'save' , ' updateOne', 'deleteOne' , 'validate' ] , { document : false , query : false } , function ( ) {
913
827
expectType < never > ( this ) ;
914
828
} ) ;
915
829
916
- schema . post ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : false , query : false } , function ( res ) {
830
+ schema . post ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , 'save' , ' updateOne', 'deleteOne' , 'validate' ] , { document : false , query : false } , function ( res ) {
917
831
expectType < never > ( this ) ;
918
832
expectNotType < Query < any , any > > ( res ) ;
919
833
} ) ;
920
834
921
- schema . pre ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , ' save' , 'init ', 'updateOne' , 'deleteOne' , 'validate' ] , function ( ) {
835
+ schema . pre ( [ 'save' , 'updateOne' , 'deleteOne' , 'validate' ] , function ( ) {
922
836
expectType < Query < any , any > | HydratedDocument < IDocument > > ( this ) ;
923
837
} ) ;
924
838
925
- schema . post ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , ' save' , 'init ', 'updateOne' , 'deleteOne' , 'validate' ] , function ( res ) {
839
+ schema . post ( [ 'save' , 'updateOne' , 'deleteOne' , 'validate' ] , function ( res ) {
926
840
expectType < Query < any , any > | HydratedDocument < IDocument > > ( this ) ;
927
841
expectNotType < Query < any , any > > ( res ) ;
928
842
} ) ;
929
843
930
- schema . pre ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , ' save' , 'init ', 'updateOne' , 'deleteOne' , 'validate' ] , { document : false , query : true } , function ( ) {
844
+ schema . pre ( [ 'save' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : false , query : true } , function ( ) {
931
845
expectType < Query < any , any > > ( this ) ;
932
846
} ) ;
933
847
934
- schema . post ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , ' save' , 'init ', 'updateOne' , 'deleteOne' , 'validate' ] , { document : false , query : true } , function ( res ) {
848
+ schema . post ( [ 'save' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : false , query : true } , function ( res ) {
935
849
expectType < Query < any , any > > ( this ) ;
936
850
expectNotType < Query < any , any > > ( res ) ;
937
851
} ) ;
938
852
939
- schema . pre ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , ' save' , 'init ', 'updateOne' , 'deleteOne' , 'validate' ] , { document : true , query : false } , function ( ) {
853
+ schema . pre ( [ 'save' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : true , query : false } , function ( ) {
940
854
expectType < HydratedDocument < IDocument > > ( this ) ;
941
855
} ) ;
942
856
943
- schema . post ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , ' save' , 'init ', 'updateOne' , 'deleteOne' , 'validate' ] , { document : true , query : false } , function ( res ) {
857
+ schema . post ( [ 'save' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : true , query : false } , function ( res ) {
944
858
expectType < HydratedDocument < IDocument > > ( this ) ;
945
859
expectNotType < Query < any , any > > ( res ) ;
946
860
} ) ;
947
861
948
- schema . pre ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , ' save' , 'init ', 'updateOne' , 'deleteOne' , 'validate' ] , { document : true , query : true } , function ( ) {
862
+ schema . pre ( [ 'save' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : true , query : true } , function ( ) {
949
863
expectType < Query < any , any > | HydratedDocument < IDocument > > ( this ) ;
950
864
} ) ;
951
865
952
- schema . post ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , ' save' , 'init ', 'updateOne' , 'deleteOne' , 'validate' ] , { document : true , query : true } , function ( res ) {
866
+ schema . post ( [ 'save' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : true , query : true } , function ( res ) {
953
867
expectType < Query < any , any > | HydratedDocument < IDocument > > ( this ) ;
954
868
expectNotType < Query < any , any > > ( res ) ;
955
869
} ) ;
956
870
957
- schema . pre ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , ' save' , 'init ', 'updateOne' , 'deleteOne' , 'validate' ] , { document : false , query : false } , function ( ) {
871
+ schema . pre ( [ 'save' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : false , query : false } , function ( ) {
958
872
expectType < never > ( this ) ;
959
873
} ) ;
960
874
961
- schema . post ( [ 'estimatedDocumentCount' , 'countDocuments' , 'deleteMany' , 'distinct' , 'find' , 'findOne' , 'findOneAndDelete' , 'findOneAndReplace' , 'findOneAndUpdate' , 'replaceOne' , 'updateMany' , ' save' , 'init ', 'updateOne' , 'deleteOne' , 'validate' ] , { document : false , query : false } , function ( res ) {
875
+ schema . post ( [ 'save' , 'updateOne' , 'deleteOne' , 'validate' ] , { document : false , query : false } , function ( res ) {
962
876
expectType < never > ( this ) ;
963
877
expectNotType < Query < any , any > > ( res ) ;
964
878
} ) ;
0 commit comments