mongoose 8.9.1 → 8.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.umd.js +1 -1
- package/lib/aggregate.js +21 -4
- package/lib/connection.js +1 -1
- package/lib/cursor/queryCursor.js +3 -9
- package/lib/document.js +9 -6
- package/lib/helpers/indexes/isIndexSpecEqual.js +32 -0
- package/lib/model.js +29 -8
- package/lib/query.js +1 -4
- package/lib/schema.js +4 -4
- package/lib/types/map.js +8 -1
- package/lib/utils.js +3 -0
- package/package.json +1 -1
- package/types/index.d.ts +76 -57
- package/types/indexes.d.ts +3 -0
- package/types/models.d.ts +47 -47
- package/types/query.d.ts +49 -49
package/types/models.d.ts
CHANGED
|
@@ -333,7 +333,7 @@ declare module 'mongoose' {
|
|
|
333
333
|
TQueryHelpers,
|
|
334
334
|
TRawDocType,
|
|
335
335
|
'countDocuments',
|
|
336
|
-
TInstanceMethods
|
|
336
|
+
TInstanceMethods & TVirtuals
|
|
337
337
|
>;
|
|
338
338
|
|
|
339
339
|
/** Creates a new document or documents */
|
|
@@ -372,7 +372,7 @@ declare module 'mongoose' {
|
|
|
372
372
|
TQueryHelpers,
|
|
373
373
|
TRawDocType,
|
|
374
374
|
'deleteMany',
|
|
375
|
-
TInstanceMethods
|
|
375
|
+
TInstanceMethods & TVirtuals
|
|
376
376
|
>;
|
|
377
377
|
deleteMany(
|
|
378
378
|
filter: RootFilterQuery<TRawDocType>
|
|
@@ -382,7 +382,7 @@ declare module 'mongoose' {
|
|
|
382
382
|
TQueryHelpers,
|
|
383
383
|
TRawDocType,
|
|
384
384
|
'deleteMany',
|
|
385
|
-
TInstanceMethods
|
|
385
|
+
TInstanceMethods & TVirtuals
|
|
386
386
|
>;
|
|
387
387
|
|
|
388
388
|
/**
|
|
@@ -399,7 +399,7 @@ declare module 'mongoose' {
|
|
|
399
399
|
TQueryHelpers,
|
|
400
400
|
TRawDocType,
|
|
401
401
|
'deleteOne',
|
|
402
|
-
TInstanceMethods
|
|
402
|
+
TInstanceMethods & TVirtuals
|
|
403
403
|
>;
|
|
404
404
|
deleteOne(
|
|
405
405
|
filter: RootFilterQuery<TRawDocType>
|
|
@@ -409,7 +409,7 @@ declare module 'mongoose' {
|
|
|
409
409
|
TQueryHelpers,
|
|
410
410
|
TRawDocType,
|
|
411
411
|
'deleteOne',
|
|
412
|
-
TInstanceMethods
|
|
412
|
+
TInstanceMethods & TVirtuals
|
|
413
413
|
>;
|
|
414
414
|
|
|
415
415
|
/**
|
|
@@ -439,17 +439,17 @@ declare module 'mongoose' {
|
|
|
439
439
|
TQueryHelpers,
|
|
440
440
|
TRawDocType,
|
|
441
441
|
'findOne',
|
|
442
|
-
TInstanceMethods
|
|
442
|
+
TInstanceMethods & TVirtuals
|
|
443
443
|
>;
|
|
444
444
|
findById<ResultDoc = THydratedDocumentType>(
|
|
445
445
|
id: any,
|
|
446
446
|
projection?: ProjectionType<TRawDocType> | null,
|
|
447
447
|
options?: QueryOptions<TRawDocType> | null
|
|
448
|
-
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOne', TInstanceMethods>;
|
|
448
|
+
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOne', TInstanceMethods & TVirtuals>;
|
|
449
449
|
findById<ResultDoc = THydratedDocumentType>(
|
|
450
450
|
id: any,
|
|
451
451
|
projection?: ProjectionType<TRawDocType> | null
|
|
452
|
-
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOne', TInstanceMethods>;
|
|
452
|
+
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOne', TInstanceMethods & TVirtuals>;
|
|
453
453
|
|
|
454
454
|
/** Finds one document. */
|
|
455
455
|
findOne<ResultDoc = THydratedDocumentType>(
|
|
@@ -462,20 +462,20 @@ declare module 'mongoose' {
|
|
|
462
462
|
TQueryHelpers,
|
|
463
463
|
TRawDocType,
|
|
464
464
|
'findOne',
|
|
465
|
-
TInstanceMethods
|
|
465
|
+
TInstanceMethods & TVirtuals
|
|
466
466
|
>;
|
|
467
467
|
findOne<ResultDoc = THydratedDocumentType>(
|
|
468
468
|
filter?: RootFilterQuery<TRawDocType>,
|
|
469
469
|
projection?: ProjectionType<TRawDocType> | null,
|
|
470
470
|
options?: QueryOptions<TRawDocType> | null
|
|
471
|
-
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOne', TInstanceMethods>;
|
|
471
|
+
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOne', TInstanceMethods & TVirtuals>;
|
|
472
472
|
findOne<ResultDoc = THydratedDocumentType>(
|
|
473
473
|
filter?: RootFilterQuery<TRawDocType>,
|
|
474
474
|
projection?: ProjectionType<TRawDocType> | null
|
|
475
|
-
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOne', TInstanceMethods>;
|
|
475
|
+
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOne', TInstanceMethods & TVirtuals>;
|
|
476
476
|
findOne<ResultDoc = THydratedDocumentType>(
|
|
477
477
|
filter?: RootFilterQuery<TRawDocType>
|
|
478
|
-
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOne', TInstanceMethods>;
|
|
478
|
+
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOne', TInstanceMethods & TVirtuals>;
|
|
479
479
|
|
|
480
480
|
/**
|
|
481
481
|
* Shortcut for creating a new Document from existing raw data, pre-saved in the DB.
|
|
@@ -617,7 +617,7 @@ declare module 'mongoose' {
|
|
|
617
617
|
watch<ResultType extends mongodb.Document = any, ChangeType extends mongodb.ChangeStreamDocument = any>(pipeline?: Array<Record<string, unknown>>, options?: mongodb.ChangeStreamOptions & { hydrate?: boolean }): mongodb.ChangeStream<ResultType, ChangeType>;
|
|
618
618
|
|
|
619
619
|
/** Adds a `$where` clause to this query */
|
|
620
|
-
$where(argument: string | Function): QueryWithHelpers<Array<THydratedDocumentType>, THydratedDocumentType, TQueryHelpers, TRawDocType, 'find', TInstanceMethods>;
|
|
620
|
+
$where(argument: string | Function): QueryWithHelpers<Array<THydratedDocumentType>, THydratedDocumentType, TQueryHelpers, TRawDocType, 'find', TInstanceMethods & TVirtuals>;
|
|
621
621
|
|
|
622
622
|
/** Registered discriminators for this model. */
|
|
623
623
|
discriminators: { [name: string]: Model<any> } | undefined;
|
|
@@ -640,7 +640,7 @@ declare module 'mongoose' {
|
|
|
640
640
|
TQueryHelpers,
|
|
641
641
|
TRawDocType,
|
|
642
642
|
'distinct',
|
|
643
|
-
TInstanceMethods
|
|
643
|
+
TInstanceMethods & TVirtuals
|
|
644
644
|
>;
|
|
645
645
|
|
|
646
646
|
/** Creates a `estimatedDocumentCount` query: counts the number of documents in the collection. */
|
|
@@ -650,7 +650,7 @@ declare module 'mongoose' {
|
|
|
650
650
|
TQueryHelpers,
|
|
651
651
|
TRawDocType,
|
|
652
652
|
'estimatedDocumentCount',
|
|
653
|
-
TInstanceMethods
|
|
653
|
+
TInstanceMethods & TVirtuals
|
|
654
654
|
>;
|
|
655
655
|
|
|
656
656
|
/**
|
|
@@ -665,7 +665,7 @@ declare module 'mongoose' {
|
|
|
665
665
|
TQueryHelpers,
|
|
666
666
|
TRawDocType,
|
|
667
667
|
'findOne',
|
|
668
|
-
TInstanceMethods
|
|
668
|
+
TInstanceMethods & TVirtuals
|
|
669
669
|
>;
|
|
670
670
|
|
|
671
671
|
/** Creates a `find` query: gets a list of documents that match `filter`. */
|
|
@@ -679,22 +679,22 @@ declare module 'mongoose' {
|
|
|
679
679
|
TQueryHelpers,
|
|
680
680
|
TRawDocType,
|
|
681
681
|
'find',
|
|
682
|
-
TInstanceMethods
|
|
682
|
+
TInstanceMethods & TVirtuals
|
|
683
683
|
>;
|
|
684
684
|
find<ResultDoc = THydratedDocumentType>(
|
|
685
685
|
filter: RootFilterQuery<TRawDocType>,
|
|
686
686
|
projection?: ProjectionType<TRawDocType> | null | undefined,
|
|
687
687
|
options?: QueryOptions<TRawDocType> | null | undefined
|
|
688
|
-
): QueryWithHelpers<Array<ResultDoc>, ResultDoc, TQueryHelpers, TRawDocType, 'find', TInstanceMethods>;
|
|
688
|
+
): QueryWithHelpers<Array<ResultDoc>, ResultDoc, TQueryHelpers, TRawDocType, 'find', TInstanceMethods & TVirtuals>;
|
|
689
689
|
find<ResultDoc = THydratedDocumentType>(
|
|
690
690
|
filter: RootFilterQuery<TRawDocType>,
|
|
691
691
|
projection?: ProjectionType<TRawDocType> | null | undefined
|
|
692
|
-
): QueryWithHelpers<Array<ResultDoc>, ResultDoc, TQueryHelpers, TRawDocType, 'find', TInstanceMethods>;
|
|
692
|
+
): QueryWithHelpers<Array<ResultDoc>, ResultDoc, TQueryHelpers, TRawDocType, 'find', TInstanceMethods & TVirtuals>;
|
|
693
693
|
find<ResultDoc = THydratedDocumentType>(
|
|
694
694
|
filter: RootFilterQuery<TRawDocType>
|
|
695
|
-
): QueryWithHelpers<Array<ResultDoc>, ResultDoc, TQueryHelpers, TRawDocType, 'find', TInstanceMethods>;
|
|
695
|
+
): QueryWithHelpers<Array<ResultDoc>, ResultDoc, TQueryHelpers, TRawDocType, 'find', TInstanceMethods & TVirtuals>;
|
|
696
696
|
find<ResultDoc = THydratedDocumentType>(
|
|
697
|
-
): QueryWithHelpers<Array<ResultDoc>, ResultDoc, TQueryHelpers, TRawDocType, 'find', TInstanceMethods>;
|
|
697
|
+
): QueryWithHelpers<Array<ResultDoc>, ResultDoc, TQueryHelpers, TRawDocType, 'find', TInstanceMethods & TVirtuals>;
|
|
698
698
|
|
|
699
699
|
/** Creates a `findByIdAndDelete` query, filtering by the given `_id`. */
|
|
700
700
|
findByIdAndDelete<ResultDoc = THydratedDocumentType>(
|
|
@@ -706,16 +706,16 @@ declare module 'mongoose' {
|
|
|
706
706
|
TQueryHelpers,
|
|
707
707
|
TRawDocType,
|
|
708
708
|
'findOneAndDelete',
|
|
709
|
-
TInstanceMethods
|
|
709
|
+
TInstanceMethods & TVirtuals
|
|
710
710
|
>;
|
|
711
711
|
findByIdAndDelete<ResultDoc = THydratedDocumentType>(
|
|
712
712
|
id: mongodb.ObjectId | any,
|
|
713
713
|
options: QueryOptions<TRawDocType> & { includeResultMetadata: true }
|
|
714
|
-
): QueryWithHelpers<ModifyResult<ResultDoc>, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndDelete', TInstanceMethods>;
|
|
714
|
+
): QueryWithHelpers<ModifyResult<ResultDoc>, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndDelete', TInstanceMethods & TVirtuals>;
|
|
715
715
|
findByIdAndDelete<ResultDoc = THydratedDocumentType>(
|
|
716
716
|
id?: mongodb.ObjectId | any,
|
|
717
717
|
options?: QueryOptions<TRawDocType> | null
|
|
718
|
-
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndDelete', TInstanceMethods>;
|
|
718
|
+
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndDelete', TInstanceMethods & TVirtuals>;
|
|
719
719
|
|
|
720
720
|
/** Creates a `findOneAndUpdate` query, filtering by the given `_id`. */
|
|
721
721
|
findByIdAndUpdate<ResultDoc = THydratedDocumentType>(
|
|
@@ -728,7 +728,7 @@ declare module 'mongoose' {
|
|
|
728
728
|
TQueryHelpers,
|
|
729
729
|
TRawDocType,
|
|
730
730
|
'findOneAndUpdate',
|
|
731
|
-
TInstanceMethods
|
|
731
|
+
TInstanceMethods & TVirtuals
|
|
732
732
|
>;
|
|
733
733
|
findByIdAndUpdate<ResultDoc = THydratedDocumentType>(
|
|
734
734
|
id: mongodb.ObjectId | any,
|
|
@@ -740,27 +740,27 @@ declare module 'mongoose' {
|
|
|
740
740
|
TQueryHelpers,
|
|
741
741
|
TRawDocType,
|
|
742
742
|
'findOneAndUpdate',
|
|
743
|
-
TInstanceMethods
|
|
743
|
+
TInstanceMethods & TVirtuals
|
|
744
744
|
>;
|
|
745
745
|
findByIdAndUpdate<ResultDoc = THydratedDocumentType>(
|
|
746
746
|
id: mongodb.ObjectId | any,
|
|
747
747
|
update: UpdateQuery<TRawDocType>,
|
|
748
748
|
options: QueryOptions<TRawDocType> & { includeResultMetadata: true }
|
|
749
|
-
): QueryWithHelpers<ModifyResult<ResultDoc>, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndUpdate', TInstanceMethods>;
|
|
749
|
+
): QueryWithHelpers<ModifyResult<ResultDoc>, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndUpdate', TInstanceMethods & TVirtuals>;
|
|
750
750
|
findByIdAndUpdate<ResultDoc = THydratedDocumentType>(
|
|
751
751
|
id: mongodb.ObjectId | any,
|
|
752
752
|
update: UpdateQuery<TRawDocType>,
|
|
753
753
|
options: QueryOptions<TRawDocType> & { upsert: true } & ReturnsNewDoc
|
|
754
|
-
): QueryWithHelpers<ResultDoc, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndUpdate', TInstanceMethods>;
|
|
754
|
+
): QueryWithHelpers<ResultDoc, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndUpdate', TInstanceMethods & TVirtuals>;
|
|
755
755
|
findByIdAndUpdate<ResultDoc = THydratedDocumentType>(
|
|
756
756
|
id?: mongodb.ObjectId | any,
|
|
757
757
|
update?: UpdateQuery<TRawDocType>,
|
|
758
758
|
options?: QueryOptions<TRawDocType> | null
|
|
759
|
-
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndUpdate', TInstanceMethods>;
|
|
759
|
+
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndUpdate', TInstanceMethods & TVirtuals>;
|
|
760
760
|
findByIdAndUpdate<ResultDoc = THydratedDocumentType>(
|
|
761
761
|
id: mongodb.ObjectId | any,
|
|
762
762
|
update: UpdateQuery<TRawDocType>
|
|
763
|
-
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndUpdate', TInstanceMethods>;
|
|
763
|
+
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndUpdate', TInstanceMethods & TVirtuals>;
|
|
764
764
|
|
|
765
765
|
/** Creates a `findOneAndDelete` query: atomically finds the given document, deletes it, and returns the document as it was before deletion. */
|
|
766
766
|
findOneAndDelete<ResultDoc = THydratedDocumentType>(
|
|
@@ -772,16 +772,16 @@ declare module 'mongoose' {
|
|
|
772
772
|
TQueryHelpers,
|
|
773
773
|
TRawDocType,
|
|
774
774
|
'findOneAndDelete',
|
|
775
|
-
TInstanceMethods
|
|
775
|
+
TInstanceMethods & TVirtuals
|
|
776
776
|
>;
|
|
777
777
|
findOneAndDelete<ResultDoc = THydratedDocumentType>(
|
|
778
778
|
filter: RootFilterQuery<TRawDocType>,
|
|
779
779
|
options: QueryOptions<TRawDocType> & { includeResultMetadata: true }
|
|
780
|
-
): QueryWithHelpers<ModifyResult<ResultDoc>, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndDelete', TInstanceMethods>;
|
|
780
|
+
): QueryWithHelpers<ModifyResult<ResultDoc>, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndDelete', TInstanceMethods & TVirtuals>;
|
|
781
781
|
findOneAndDelete<ResultDoc = THydratedDocumentType>(
|
|
782
782
|
filter?: RootFilterQuery<TRawDocType> | null,
|
|
783
783
|
options?: QueryOptions<TRawDocType> | null
|
|
784
|
-
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndDelete', TInstanceMethods>;
|
|
784
|
+
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndDelete', TInstanceMethods & TVirtuals>;
|
|
785
785
|
|
|
786
786
|
/** Creates a `findOneAndReplace` query: atomically finds the given document and replaces it with `replacement`. */
|
|
787
787
|
findOneAndReplace<ResultDoc = THydratedDocumentType>(
|
|
@@ -794,23 +794,23 @@ declare module 'mongoose' {
|
|
|
794
794
|
TQueryHelpers,
|
|
795
795
|
TRawDocType,
|
|
796
796
|
'findOneAndReplace',
|
|
797
|
-
TInstanceMethods
|
|
797
|
+
TInstanceMethods & TVirtuals
|
|
798
798
|
>;
|
|
799
799
|
findOneAndReplace<ResultDoc = THydratedDocumentType>(
|
|
800
800
|
filter: RootFilterQuery<TRawDocType>,
|
|
801
801
|
replacement: TRawDocType | AnyObject,
|
|
802
802
|
options: QueryOptions<TRawDocType> & { includeResultMetadata: true }
|
|
803
|
-
): QueryWithHelpers<ModifyResult<ResultDoc>, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndReplace', TInstanceMethods>;
|
|
803
|
+
): QueryWithHelpers<ModifyResult<ResultDoc>, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndReplace', TInstanceMethods & TVirtuals>;
|
|
804
804
|
findOneAndReplace<ResultDoc = THydratedDocumentType>(
|
|
805
805
|
filter: RootFilterQuery<TRawDocType>,
|
|
806
806
|
replacement: TRawDocType | AnyObject,
|
|
807
807
|
options: QueryOptions<TRawDocType> & { upsert: true } & ReturnsNewDoc
|
|
808
|
-
): QueryWithHelpers<ResultDoc, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndReplace', TInstanceMethods>;
|
|
808
|
+
): QueryWithHelpers<ResultDoc, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndReplace', TInstanceMethods & TVirtuals>;
|
|
809
809
|
findOneAndReplace<ResultDoc = THydratedDocumentType>(
|
|
810
810
|
filter?: RootFilterQuery<TRawDocType>,
|
|
811
811
|
replacement?: TRawDocType | AnyObject,
|
|
812
812
|
options?: QueryOptions<TRawDocType> | null
|
|
813
|
-
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndReplace', TInstanceMethods>;
|
|
813
|
+
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndReplace', TInstanceMethods & TVirtuals>;
|
|
814
814
|
|
|
815
815
|
/** Creates a `findOneAndUpdate` query: atomically find the first document that matches `filter` and apply `update`. */
|
|
816
816
|
findOneAndUpdate<ResultDoc = THydratedDocumentType>(
|
|
@@ -823,7 +823,7 @@ declare module 'mongoose' {
|
|
|
823
823
|
TQueryHelpers,
|
|
824
824
|
TRawDocType,
|
|
825
825
|
'findOneAndUpdate',
|
|
826
|
-
TInstanceMethods
|
|
826
|
+
TInstanceMethods & TVirtuals
|
|
827
827
|
>;
|
|
828
828
|
findOneAndUpdate<ResultDoc = THydratedDocumentType>(
|
|
829
829
|
filter: RootFilterQuery<TRawDocType>,
|
|
@@ -835,30 +835,30 @@ declare module 'mongoose' {
|
|
|
835
835
|
TQueryHelpers,
|
|
836
836
|
TRawDocType,
|
|
837
837
|
'findOneAndUpdate',
|
|
838
|
-
TInstanceMethods
|
|
838
|
+
TInstanceMethods & TVirtuals
|
|
839
839
|
>;
|
|
840
840
|
findOneAndUpdate<ResultDoc = THydratedDocumentType>(
|
|
841
841
|
filter: RootFilterQuery<TRawDocType>,
|
|
842
842
|
update: UpdateQuery<TRawDocType>,
|
|
843
843
|
options: QueryOptions<TRawDocType> & { includeResultMetadata: true }
|
|
844
|
-
): QueryWithHelpers<ModifyResult<ResultDoc>, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndUpdate', TInstanceMethods>;
|
|
844
|
+
): QueryWithHelpers<ModifyResult<ResultDoc>, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndUpdate', TInstanceMethods & TVirtuals>;
|
|
845
845
|
findOneAndUpdate<ResultDoc = THydratedDocumentType>(
|
|
846
846
|
filter: RootFilterQuery<TRawDocType>,
|
|
847
847
|
update: UpdateQuery<TRawDocType>,
|
|
848
848
|
options: QueryOptions<TRawDocType> & { upsert: true } & ReturnsNewDoc
|
|
849
|
-
): QueryWithHelpers<ResultDoc, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndUpdate', TInstanceMethods>;
|
|
849
|
+
): QueryWithHelpers<ResultDoc, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndUpdate', TInstanceMethods & TVirtuals>;
|
|
850
850
|
findOneAndUpdate<ResultDoc = THydratedDocumentType>(
|
|
851
851
|
filter?: RootFilterQuery<TRawDocType>,
|
|
852
852
|
update?: UpdateQuery<TRawDocType>,
|
|
853
853
|
options?: QueryOptions<TRawDocType> | null
|
|
854
|
-
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndUpdate', TInstanceMethods>;
|
|
854
|
+
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOneAndUpdate', TInstanceMethods & TVirtuals>;
|
|
855
855
|
|
|
856
856
|
/** Creates a `replaceOne` query: finds the first document that matches `filter` and replaces it with `replacement`. */
|
|
857
857
|
replaceOne<ResultDoc = THydratedDocumentType>(
|
|
858
858
|
filter?: RootFilterQuery<TRawDocType>,
|
|
859
859
|
replacement?: TRawDocType | AnyObject,
|
|
860
860
|
options?: (mongodb.ReplaceOptions & MongooseQueryOptions<TRawDocType>) | null
|
|
861
|
-
): QueryWithHelpers<UpdateWriteOpResult, ResultDoc, TQueryHelpers, TRawDocType, 'replaceOne', TInstanceMethods>;
|
|
861
|
+
): QueryWithHelpers<UpdateWriteOpResult, ResultDoc, TQueryHelpers, TRawDocType, 'replaceOne', TInstanceMethods & TVirtuals>;
|
|
862
862
|
|
|
863
863
|
/** Apply changes made to this model's schema after this model was compiled. */
|
|
864
864
|
recompileSchema(): void;
|
|
@@ -871,14 +871,14 @@ declare module 'mongoose' {
|
|
|
871
871
|
filter?: RootFilterQuery<TRawDocType>,
|
|
872
872
|
update?: UpdateQuery<TRawDocType> | UpdateWithAggregationPipeline,
|
|
873
873
|
options?: (mongodb.UpdateOptions & MongooseUpdateQueryOptions<TRawDocType>) | null
|
|
874
|
-
): QueryWithHelpers<UpdateWriteOpResult, ResultDoc, TQueryHelpers, TRawDocType, 'updateMany', TInstanceMethods>;
|
|
874
|
+
): QueryWithHelpers<UpdateWriteOpResult, ResultDoc, TQueryHelpers, TRawDocType, 'updateMany', TInstanceMethods & TVirtuals>;
|
|
875
875
|
|
|
876
876
|
/** Creates a `updateOne` query: updates the first document that matches `filter` with `update`. */
|
|
877
877
|
updateOne<ResultDoc = THydratedDocumentType>(
|
|
878
878
|
filter?: RootFilterQuery<TRawDocType>,
|
|
879
879
|
update?: UpdateQuery<TRawDocType> | UpdateWithAggregationPipeline,
|
|
880
880
|
options?: (mongodb.UpdateOptions & MongooseUpdateQueryOptions<TRawDocType>) | null
|
|
881
|
-
): QueryWithHelpers<UpdateWriteOpResult, ResultDoc, TQueryHelpers, TRawDocType, 'updateOne', TInstanceMethods>;
|
|
881
|
+
): QueryWithHelpers<UpdateWriteOpResult, ResultDoc, TQueryHelpers, TRawDocType, 'updateOne', TInstanceMethods & TVirtuals>;
|
|
882
882
|
|
|
883
883
|
/** Creates a Query, applies the passed conditions, and returns the Query. */
|
|
884
884
|
where<ResultDoc = THydratedDocumentType>(
|
|
@@ -891,7 +891,7 @@ declare module 'mongoose' {
|
|
|
891
891
|
TQueryHelpers,
|
|
892
892
|
TRawDocType,
|
|
893
893
|
'find',
|
|
894
|
-
TInstanceMethods
|
|
894
|
+
TInstanceMethods & TVirtuals
|
|
895
895
|
>;
|
|
896
896
|
where<ResultDoc = THydratedDocumentType>(): QueryWithHelpers<
|
|
897
897
|
Array<ResultDoc>,
|
|
@@ -899,7 +899,7 @@ declare module 'mongoose' {
|
|
|
899
899
|
TQueryHelpers,
|
|
900
900
|
TRawDocType,
|
|
901
901
|
'find',
|
|
902
|
-
TInstanceMethods
|
|
902
|
+
TInstanceMethods & TVirtuals
|
|
903
903
|
>;
|
|
904
904
|
}
|
|
905
905
|
}
|