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