mongoose 8.16.5 → 8.17.1
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/helpers/model/discriminator.js +2 -1
- package/lib/model.js +2 -13
- package/lib/mongoose.js +22 -0
- package/lib/query.js +23 -18
- package/lib/schema/array.js +8 -0
- package/lib/schema/bigint.js +8 -0
- package/lib/schema/boolean.js +8 -0
- package/lib/schema/buffer.js +8 -0
- package/lib/schema/date.js +8 -0
- package/lib/schema/decimal128.js +8 -0
- package/lib/schema/documentArray.js +13 -1
- package/lib/schema/double.js +8 -0
- package/lib/schema/int32.js +8 -0
- package/lib/schema/number.js +8 -0
- package/lib/schema/objectId.js +8 -0
- package/lib/schema/string.js +11 -3
- package/lib/schema/subdocument.js +27 -9
- package/lib/schema/uuid.js +8 -0
- package/lib/schemaType.js +6 -2
- package/package.json +6 -6
- package/types/aggregate.d.ts +1 -1
- package/types/collection.d.ts +2 -0
- package/types/connection.d.ts +2 -0
- package/types/document.d.ts +16 -16
- package/types/index.d.ts +20 -20
- package/types/models.d.ts +30 -9
- package/types/query.d.ts +4 -14
- package/types/schematypes.d.ts +24 -17
package/types/index.d.ts
CHANGED
|
@@ -91,7 +91,8 @@ declare module 'mongoose' {
|
|
|
91
91
|
InferSchemaType<TSchema>,
|
|
92
92
|
ObtainSchemaGeneric<TSchema, 'TVirtuals'> & ObtainSchemaGeneric<TSchema, 'TInstanceMethods'>,
|
|
93
93
|
ObtainSchemaGeneric<TSchema, 'TQueryHelpers'>,
|
|
94
|
-
ObtainSchemaGeneric<TSchema, 'TVirtuals'
|
|
94
|
+
ObtainSchemaGeneric<TSchema, 'TVirtuals'>,
|
|
95
|
+
ObtainSchemaGeneric<TSchema, 'TSchemaOptions'>
|
|
95
96
|
>,
|
|
96
97
|
TSchema
|
|
97
98
|
> & ObtainSchemaGeneric<TSchema, 'TStaticMethods'>;
|
|
@@ -139,7 +140,7 @@ declare module 'mongoose' {
|
|
|
139
140
|
? IfAny<U, T & { _id: Types.ObjectId }, T & Required<{ _id: U }>>
|
|
140
141
|
: T & { _id: Types.ObjectId };
|
|
141
142
|
|
|
142
|
-
export type Default__v<T> = T extends { __v?: infer U }
|
|
143
|
+
export type Default__v<T, TSchemaOptions = {}> = TSchemaOptions extends { versionKey: false } ? T : T extends { __v?: infer U }
|
|
143
144
|
? T
|
|
144
145
|
: T & { __v: number };
|
|
145
146
|
|
|
@@ -148,17 +149,18 @@ declare module 'mongoose' {
|
|
|
148
149
|
DocType,
|
|
149
150
|
TOverrides = {},
|
|
150
151
|
TQueryHelpers = {},
|
|
151
|
-
TVirtuals = {}
|
|
152
|
+
TVirtuals = {},
|
|
153
|
+
TSchemaOptions = {}
|
|
152
154
|
> = IfAny<
|
|
153
155
|
DocType,
|
|
154
156
|
any,
|
|
155
157
|
TOverrides extends Record<string, never> ?
|
|
156
|
-
Document<unknown, TQueryHelpers, DocType, TVirtuals> & Default__v<Require_id<DocType
|
|
158
|
+
Document<unknown, TQueryHelpers, DocType, TVirtuals, TSchemaOptions> & Default__v<Require_id<DocType>, TSchemaOptions> :
|
|
157
159
|
IfAny<
|
|
158
160
|
TOverrides,
|
|
159
|
-
Document<unknown, TQueryHelpers, DocType, TVirtuals> & Default__v<Require_id<DocType
|
|
160
|
-
Document<unknown, TQueryHelpers, DocType, TVirtuals> & MergeType<
|
|
161
|
-
Default__v<Require_id<DocType
|
|
161
|
+
Document<unknown, TQueryHelpers, DocType, TVirtuals, TSchemaOptions> & Default__v<Require_id<DocType>, TSchemaOptions>,
|
|
162
|
+
Document<unknown, TQueryHelpers, DocType, TVirtuals, TSchemaOptions> & MergeType<
|
|
163
|
+
Default__v<Require_id<DocType>, TSchemaOptions>,
|
|
162
164
|
TOverrides
|
|
163
165
|
>
|
|
164
166
|
>
|
|
@@ -196,10 +198,11 @@ declare module 'mongoose' {
|
|
|
196
198
|
>;
|
|
197
199
|
|
|
198
200
|
export type HydratedDocumentFromSchema<TSchema extends Schema> = HydratedDocument<
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
InferSchemaType<TSchema>,
|
|
202
|
+
ObtainSchemaGeneric<TSchema, 'TInstanceMethods'> & ObtainSchemaGeneric<TSchema, 'TVirtuals'>,
|
|
203
|
+
ObtainSchemaGeneric<TSchema, 'TQueryHelpers'>,
|
|
204
|
+
ObtainSchemaGeneric<TSchema, 'TVirtuals'>,
|
|
205
|
+
ObtainSchemaGeneric<TSchema, 'TSchemaOptions'>
|
|
203
206
|
>;
|
|
204
207
|
|
|
205
208
|
export interface TagSet {
|
|
@@ -272,7 +275,7 @@ declare module 'mongoose' {
|
|
|
272
275
|
ObtainDocumentType<any, RawDocType, ResolveSchemaOptions<TSchemaOptions>>,
|
|
273
276
|
ResolveSchemaOptions<TSchemaOptions>
|
|
274
277
|
>,
|
|
275
|
-
THydratedDocumentType = HydratedDocument<FlatRecord<DocType>, TVirtuals & TInstanceMethods, {}, TVirtuals
|
|
278
|
+
THydratedDocumentType = HydratedDocument<FlatRecord<DocType>, TVirtuals & TInstanceMethods, {}, TVirtuals, ResolveSchemaOptions<TSchemaOptions>>
|
|
276
279
|
>
|
|
277
280
|
extends events.EventEmitter {
|
|
278
281
|
/**
|
|
@@ -370,6 +373,8 @@ declare module 'mongoose' {
|
|
|
370
373
|
/** Returns a new schema that has the `paths` from the original schema, minus the omitted ones. */
|
|
371
374
|
omit<T = this>(paths: string[], options?: SchemaOptions): T;
|
|
372
375
|
|
|
376
|
+
options: SchemaOptions;
|
|
377
|
+
|
|
373
378
|
/** Gets/sets schema paths. */
|
|
374
379
|
path<ResultType extends SchemaType = SchemaType<any, THydratedDocumentType>>(path: string): ResultType;
|
|
375
380
|
path<pathGeneric extends keyof RawDocType>(path: pathGeneric): SchemaType<RawDocType[pathGeneric]>;
|
|
@@ -602,7 +607,7 @@ declare module 'mongoose' {
|
|
|
602
607
|
| typeof Schema.Types.UUID;
|
|
603
608
|
|
|
604
609
|
|
|
605
|
-
export type InferId<T> = T
|
|
610
|
+
export type InferId<T> = mongodb.InferIdType<T>;
|
|
606
611
|
|
|
607
612
|
export interface VirtualTypeOptions<HydratedDocType = Document, DocType = unknown> {
|
|
608
613
|
/** If `ref` is not nullish, this becomes a populated virtual. */
|
|
@@ -699,9 +704,9 @@ declare module 'mongoose' {
|
|
|
699
704
|
[K in keyof T]?: T[K] extends Record<string, any> ? Projector<T[K], Element> | Element : Element;
|
|
700
705
|
}
|
|
701
706
|
: Element;
|
|
702
|
-
type _IDType = { _id?: boolean |
|
|
707
|
+
type _IDType = { _id?: boolean | number };
|
|
703
708
|
export type InclusionProjection<T> = IsItRecordAndNotAny<T> extends true
|
|
704
|
-
? Omit<Projector<WithLevel1NestedPaths<T>,
|
|
709
|
+
? Omit<Projector<WithLevel1NestedPaths<T>, boolean | number>, '_id'> & _IDType
|
|
705
710
|
: AnyObject;
|
|
706
711
|
export type ExclusionProjection<T> = IsItRecordAndNotAny<T> extends true
|
|
707
712
|
? Omit<Projector<WithLevel1NestedPaths<T>, false | 0>, '_id'> & _IDType
|
|
@@ -897,11 +902,6 @@ declare module 'mongoose' {
|
|
|
897
902
|
|
|
898
903
|
export type SchemaDefinitionType<T> = T extends Document ? Omit<T, Exclude<keyof Document, '_id' | 'id' | '__v'>> : T;
|
|
899
904
|
|
|
900
|
-
/**
|
|
901
|
-
* Helper to choose the best option between two type helpers
|
|
902
|
-
*/
|
|
903
|
-
export type _pickObject<T1, T2, Fallback> = T1 extends false ? T2 extends false ? Fallback : T2 : T1;
|
|
904
|
-
|
|
905
905
|
/* for ts-mongoose */
|
|
906
906
|
export class mquery { }
|
|
907
907
|
|
package/types/models.d.ts
CHANGED
|
@@ -273,7 +273,6 @@ declare module 'mongoose' {
|
|
|
273
273
|
THydratedDocumentType = HydratedDocument<TRawDocType, TVirtuals & TInstanceMethods, TQueryHelpers, TVirtuals>,
|
|
274
274
|
TSchema = any> extends
|
|
275
275
|
NodeJS.EventEmitter,
|
|
276
|
-
AcceptsDiscriminator,
|
|
277
276
|
IndexManager,
|
|
278
277
|
SessionStarter {
|
|
279
278
|
new <DocType = Partial<TRawDocType>>(doc?: DocType, fields?: any | null, options?: boolean | AnyObject): THydratedDocumentType;
|
|
@@ -313,11 +312,11 @@ declare module 'mongoose' {
|
|
|
313
312
|
* round trip to the MongoDB server.
|
|
314
313
|
*/
|
|
315
314
|
bulkWrite<DocContents = TRawDocType>(
|
|
316
|
-
writes: Array<AnyBulkWriteOperation<DocContents
|
|
315
|
+
writes: Array<AnyBulkWriteOperation<DocContents>>,
|
|
317
316
|
options: MongooseBulkWriteOptions & { ordered: false }
|
|
318
317
|
): Promise<MongooseBulkWriteResult>;
|
|
319
318
|
bulkWrite<DocContents = TRawDocType>(
|
|
320
|
-
writes: Array<AnyBulkWriteOperation<DocContents
|
|
319
|
+
writes: Array<AnyBulkWriteOperation<DocContents>>,
|
|
321
320
|
options?: MongooseBulkWriteOptions
|
|
322
321
|
): Promise<MongooseBulkWriteResult>;
|
|
323
322
|
|
|
@@ -334,7 +333,7 @@ declare module 'mongoose' {
|
|
|
334
333
|
/** Creates a `countDocuments` query: counts the number of documents that match `filter`. */
|
|
335
334
|
countDocuments(
|
|
336
335
|
filter?: RootFilterQuery<TRawDocType>,
|
|
337
|
-
options?: (mongodb.CountOptions & MongooseBaseQueryOptions<TRawDocType>) | null
|
|
336
|
+
options?: (mongodb.CountOptions & MongooseBaseQueryOptions<TRawDocType> & mongodb.Abortable) | null
|
|
338
337
|
): QueryWithHelpers<
|
|
339
338
|
number,
|
|
340
339
|
THydratedDocumentType,
|
|
@@ -426,6 +425,28 @@ declare module 'mongoose' {
|
|
|
426
425
|
TInstanceMethods & TVirtuals
|
|
427
426
|
>;
|
|
428
427
|
|
|
428
|
+
/** Adds a discriminator type. */
|
|
429
|
+
discriminator<TDiscriminatorSchema extends Schema<any, any>>(
|
|
430
|
+
name: string | number,
|
|
431
|
+
schema: TDiscriminatorSchema,
|
|
432
|
+
value?: string | number | ObjectId | DiscriminatorOptions
|
|
433
|
+
): Model<
|
|
434
|
+
TRawDocType & InferSchemaType<TDiscriminatorSchema>,
|
|
435
|
+
TQueryHelpers & ObtainSchemaGeneric<TDiscriminatorSchema, 'TQueryHelpers'>,
|
|
436
|
+
TInstanceMethods & ObtainSchemaGeneric<TDiscriminatorSchema, 'TInstanceMethods'>,
|
|
437
|
+
TVirtuals & ObtainSchemaGeneric<TDiscriminatorSchema, 'TVirtuals'>
|
|
438
|
+
> & ObtainSchemaGeneric<TDiscriminatorSchema, 'TStaticMethods'>;
|
|
439
|
+
discriminator<D>(
|
|
440
|
+
name: string | number,
|
|
441
|
+
schema: Schema,
|
|
442
|
+
value?: string | number | ObjectId | DiscriminatorOptions
|
|
443
|
+
): Model<D>;
|
|
444
|
+
discriminator<T, U>(
|
|
445
|
+
name: string | number,
|
|
446
|
+
schema: Schema<T, U>,
|
|
447
|
+
value?: string | number | ObjectId | DiscriminatorOptions
|
|
448
|
+
): U;
|
|
449
|
+
|
|
429
450
|
/**
|
|
430
451
|
* Delete an existing [Atlas search index](https://www.mongodb.com/docs/atlas/atlas-search/create-index/) by name.
|
|
431
452
|
* This function only works when connected to MongoDB Atlas.
|
|
@@ -469,7 +490,7 @@ declare module 'mongoose' {
|
|
|
469
490
|
findOne<ResultDoc = THydratedDocumentType>(
|
|
470
491
|
filter: RootFilterQuery<TRawDocType>,
|
|
471
492
|
projection: ProjectionType<TRawDocType> | null | undefined,
|
|
472
|
-
options: QueryOptions<TRawDocType> & { lean: true }
|
|
493
|
+
options: QueryOptions<TRawDocType> & { lean: true } & mongodb.Abortable
|
|
473
494
|
): QueryWithHelpers<
|
|
474
495
|
GetLeanResultType<TRawDocType, TRawDocType, 'findOne'> | null,
|
|
475
496
|
ResultDoc,
|
|
@@ -481,7 +502,7 @@ declare module 'mongoose' {
|
|
|
481
502
|
findOne<ResultDoc = THydratedDocumentType>(
|
|
482
503
|
filter?: RootFilterQuery<TRawDocType>,
|
|
483
504
|
projection?: ProjectionType<TRawDocType> | null,
|
|
484
|
-
options?: QueryOptions<TRawDocType> | null
|
|
505
|
+
options?: QueryOptions<TRawDocType> & mongodb.Abortable | null
|
|
485
506
|
): QueryWithHelpers<ResultDoc | null, ResultDoc, TQueryHelpers, TRawDocType, 'findOne', TInstanceMethods & TVirtuals>;
|
|
486
507
|
findOne<ResultDoc = THydratedDocumentType>(
|
|
487
508
|
filter?: RootFilterQuery<TRawDocType>,
|
|
@@ -700,7 +721,7 @@ declare module 'mongoose' {
|
|
|
700
721
|
find<ResultDoc = THydratedDocumentType>(
|
|
701
722
|
filter: RootFilterQuery<TRawDocType>,
|
|
702
723
|
projection: ProjectionType<TRawDocType> | null | undefined,
|
|
703
|
-
options: QueryOptions<TRawDocType> & { lean: true }
|
|
724
|
+
options: QueryOptions<TRawDocType> & { lean: true } & mongodb.Abortable
|
|
704
725
|
): QueryWithHelpers<
|
|
705
726
|
GetLeanResultType<TRawDocType, TRawDocType[], 'find'>,
|
|
706
727
|
ResultDoc,
|
|
@@ -712,7 +733,7 @@ declare module 'mongoose' {
|
|
|
712
733
|
find<ResultDoc = THydratedDocumentType>(
|
|
713
734
|
filter: RootFilterQuery<TRawDocType>,
|
|
714
735
|
projection?: ProjectionType<TRawDocType> | null | undefined,
|
|
715
|
-
options?: QueryOptions<TRawDocType> | null | undefined
|
|
736
|
+
options?: QueryOptions<TRawDocType> & mongodb.Abortable | null | undefined
|
|
716
737
|
): QueryWithHelpers<Array<ResultDoc>, ResultDoc, TQueryHelpers, TRawDocType, 'find', TInstanceMethods & TVirtuals>;
|
|
717
738
|
find<ResultDoc = THydratedDocumentType>(
|
|
718
739
|
filter: RootFilterQuery<TRawDocType>,
|
|
@@ -885,7 +906,7 @@ declare module 'mongoose' {
|
|
|
885
906
|
replaceOne<ResultDoc = THydratedDocumentType>(
|
|
886
907
|
filter?: RootFilterQuery<TRawDocType>,
|
|
887
908
|
replacement?: TRawDocType | AnyObject,
|
|
888
|
-
options?: (mongodb.ReplaceOptions &
|
|
909
|
+
options?: (mongodb.ReplaceOptions & QueryOptions<TRawDocType>) | null
|
|
889
910
|
): QueryWithHelpers<UpdateWriteOpResult, ResultDoc, TQueryHelpers, TRawDocType, 'replaceOne', TInstanceMethods & TVirtuals>;
|
|
890
911
|
|
|
891
912
|
/** Apply changes made to this model's schema after this model was compiled. */
|
package/types/query.d.ts
CHANGED
|
@@ -31,19 +31,9 @@ declare module 'mongoose' {
|
|
|
31
31
|
| 'strictQuery'
|
|
32
32
|
| 'translateAliases';
|
|
33
33
|
|
|
34
|
-
type
|
|
35
|
-
DocType = unknown,
|
|
36
|
-
Keys extends keyof QueryOptions<DocType> = MongooseBaseQueryOptionKeys | 'timestamps' | 'lean'
|
|
37
|
-
> = Pick<QueryOptions<DocType>, Keys> & {
|
|
38
|
-
[other: string]: any;
|
|
39
|
-
};
|
|
34
|
+
type MongooseBaseQueryOptions<DocType = unknown> = Pick<QueryOptions<DocType>, MongooseBaseQueryOptionKeys>;
|
|
40
35
|
|
|
41
|
-
type
|
|
42
|
-
|
|
43
|
-
type MongooseUpdateQueryOptions<DocType = unknown> = MongooseQueryOptions<
|
|
44
|
-
DocType,
|
|
45
|
-
MongooseBaseQueryOptionKeys | 'timestamps'
|
|
46
|
-
>;
|
|
36
|
+
type MongooseUpdateQueryOptions<DocType = unknown> = Pick<QueryOptions<DocType>, MongooseBaseQueryOptionKeys | 'timestamps'>;
|
|
47
37
|
|
|
48
38
|
type ProjectionFields<DocType> = { [Key in keyof DocType]?: any } & Record<string, any>;
|
|
49
39
|
|
|
@@ -239,7 +229,7 @@ declare module 'mongoose' {
|
|
|
239
229
|
: MergeType<ResultType, Paths>;
|
|
240
230
|
|
|
241
231
|
class Query<ResultType, DocType, THelpers = {}, RawDocType = unknown, QueryOp = 'find', TDocOverrides = Record<string, never>> implements SessionOperation {
|
|
242
|
-
_mongooseOptions:
|
|
232
|
+
_mongooseOptions: QueryOptions<DocType>;
|
|
243
233
|
|
|
244
234
|
/**
|
|
245
235
|
* Returns a wrapper around a [mongodb driver cursor](https://mongodb.github.io/node-mongodb-native/4.9/classes/FindCursor.html).
|
|
@@ -634,7 +624,7 @@ declare module 'mongoose' {
|
|
|
634
624
|
* Getter/setter around the current mongoose-specific options for this query
|
|
635
625
|
* Below are the current Mongoose-specific options.
|
|
636
626
|
*/
|
|
637
|
-
mongooseOptions(val?:
|
|
627
|
+
mongooseOptions(val?: QueryOptions<DocType>): QueryOptions<DocType>;
|
|
638
628
|
|
|
639
629
|
/** Specifies a `$ne` query condition. When called with one argument, the most recent path passed to `where()` is used. */
|
|
640
630
|
ne<K = string>(path: K, val: any): this;
|
package/types/schematypes.d.ts
CHANGED
|
@@ -207,9 +207,11 @@ declare module 'mongoose' {
|
|
|
207
207
|
|
|
208
208
|
/** If set, Mongoose will add a custom validator that ensures the given string's `length` is at least the given number. */
|
|
209
209
|
minlength?: number | [number, string] | readonly [number, string];
|
|
210
|
+
minLength?: number | [number, string] | readonly [number, string];
|
|
210
211
|
|
|
211
212
|
/** If set, Mongoose will add a custom validator that ensures the given string's `length` is at most the given number. */
|
|
212
213
|
maxlength?: number | [number, string] | readonly [number, string];
|
|
214
|
+
maxLength?: number | [number, string] | readonly [number, string];
|
|
213
215
|
|
|
214
216
|
[other: string]: any;
|
|
215
217
|
|
|
@@ -268,6 +270,9 @@ declare module 'mongoose' {
|
|
|
268
270
|
/** Array containing default setters for all instances of this SchemaType */
|
|
269
271
|
static setters: ((val?: unknown, priorVal?: unknown, doc?: Document<unknown>, options?: Record<string, any> | null) => unknown)[];
|
|
270
272
|
|
|
273
|
+
/** Contains the handlers for different query operators for this schema type. */
|
|
274
|
+
$conditionalHandlers: { [op: string]: (val: any, context: any) => any };
|
|
275
|
+
|
|
271
276
|
/** The class that Mongoose uses internally to instantiate this SchemaType's `options` property. */
|
|
272
277
|
OptionsConstructor: SchemaTypeOptions<T>;
|
|
273
278
|
|
|
@@ -350,7 +355,7 @@ declare module 'mongoose' {
|
|
|
350
355
|
validateAll(validators: Array<RegExp | ValidatorFunction<DocType> | Validator<DocType>>): this;
|
|
351
356
|
|
|
352
357
|
/** Default options for this SchemaType */
|
|
353
|
-
defaultOptions?: Record<string, any>;
|
|
358
|
+
static defaultOptions?: Record<string, any>;
|
|
354
359
|
}
|
|
355
360
|
|
|
356
361
|
namespace Schema {
|
|
@@ -368,7 +373,7 @@ declare module 'mongoose' {
|
|
|
368
373
|
caster?: SchemaType;
|
|
369
374
|
|
|
370
375
|
/** Default options for this SchemaType */
|
|
371
|
-
defaultOptions: Record<string, any>;
|
|
376
|
+
static defaultOptions: Record<string, any>;
|
|
372
377
|
|
|
373
378
|
/**
|
|
374
379
|
* Adds an enum validator if this is an array of strings or numbers. Equivalent to
|
|
@@ -382,7 +387,7 @@ declare module 'mongoose' {
|
|
|
382
387
|
static schemaName: 'BigInt';
|
|
383
388
|
|
|
384
389
|
/** Default options for this SchemaType */
|
|
385
|
-
defaultOptions: Record<string, any>;
|
|
390
|
+
static defaultOptions: Record<string, any>;
|
|
386
391
|
}
|
|
387
392
|
|
|
388
393
|
class Boolean extends SchemaType {
|
|
@@ -396,7 +401,7 @@ declare module 'mongoose' {
|
|
|
396
401
|
static convertToFalse: Set<any>;
|
|
397
402
|
|
|
398
403
|
/** Default options for this SchemaType */
|
|
399
|
-
defaultOptions: Record<string, any>;
|
|
404
|
+
static defaultOptions: Record<string, any>;
|
|
400
405
|
}
|
|
401
406
|
|
|
402
407
|
class Buffer extends SchemaType {
|
|
@@ -410,7 +415,7 @@ declare module 'mongoose' {
|
|
|
410
415
|
subtype(subtype: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 128): this;
|
|
411
416
|
|
|
412
417
|
/** Default options for this SchemaType */
|
|
413
|
-
defaultOptions: Record<string, any>;
|
|
418
|
+
static defaultOptions: Record<string, any>;
|
|
414
419
|
}
|
|
415
420
|
|
|
416
421
|
class Date extends SchemaType {
|
|
@@ -427,7 +432,7 @@ declare module 'mongoose' {
|
|
|
427
432
|
min(value: NativeDate, message?: string): this;
|
|
428
433
|
|
|
429
434
|
/** Default options for this SchemaType */
|
|
430
|
-
defaultOptions: Record<string, any>;
|
|
435
|
+
static defaultOptions: Record<string, any>;
|
|
431
436
|
}
|
|
432
437
|
|
|
433
438
|
class Decimal128 extends SchemaType {
|
|
@@ -435,7 +440,7 @@ declare module 'mongoose' {
|
|
|
435
440
|
static schemaName: 'Decimal128';
|
|
436
441
|
|
|
437
442
|
/** Default options for this SchemaType */
|
|
438
|
-
defaultOptions: Record<string, any>;
|
|
443
|
+
static defaultOptions: Record<string, any>;
|
|
439
444
|
}
|
|
440
445
|
|
|
441
446
|
class Int32 extends SchemaType {
|
|
@@ -443,7 +448,7 @@ declare module 'mongoose' {
|
|
|
443
448
|
static schemaName: 'Int32';
|
|
444
449
|
|
|
445
450
|
/** Default options for this SchemaType */
|
|
446
|
-
defaultOptions: Record<string, any>;
|
|
451
|
+
static defaultOptions: Record<string, any>;
|
|
447
452
|
}
|
|
448
453
|
|
|
449
454
|
class DocumentArray extends SchemaType implements AcceptsDiscriminator {
|
|
@@ -452,6 +457,8 @@ declare module 'mongoose' {
|
|
|
452
457
|
|
|
453
458
|
static options: { castNonArrays: boolean; };
|
|
454
459
|
|
|
460
|
+
schemaOptions?: SchemaOptions;
|
|
461
|
+
|
|
455
462
|
discriminator<D>(name: string | number, schema: Schema, value?: string): Model<D>;
|
|
456
463
|
discriminator<T, U>(name: string | number, schema: Schema<T, U>, value?: string): U;
|
|
457
464
|
|
|
@@ -462,7 +469,7 @@ declare module 'mongoose' {
|
|
|
462
469
|
caster?: typeof Types.Subdocument;
|
|
463
470
|
|
|
464
471
|
/** Default options for this SchemaType */
|
|
465
|
-
defaultOptions: Record<string, any>;
|
|
472
|
+
static defaultOptions: Record<string, any>;
|
|
466
473
|
}
|
|
467
474
|
|
|
468
475
|
class Map extends SchemaType {
|
|
@@ -470,7 +477,7 @@ declare module 'mongoose' {
|
|
|
470
477
|
static schemaName: 'Map';
|
|
471
478
|
|
|
472
479
|
/** Default options for this SchemaType */
|
|
473
|
-
defaultOptions: Record<string, any>;
|
|
480
|
+
static defaultOptions: Record<string, any>;
|
|
474
481
|
}
|
|
475
482
|
|
|
476
483
|
class Mixed extends SchemaType {
|
|
@@ -478,7 +485,7 @@ declare module 'mongoose' {
|
|
|
478
485
|
static schemaName: 'Mixed';
|
|
479
486
|
|
|
480
487
|
/** Default options for this SchemaType */
|
|
481
|
-
defaultOptions: Record<string, any>;
|
|
488
|
+
static defaultOptions: Record<string, any>;
|
|
482
489
|
}
|
|
483
490
|
|
|
484
491
|
class Number extends SchemaType {
|
|
@@ -495,7 +502,7 @@ declare module 'mongoose' {
|
|
|
495
502
|
min(value: number, message?: string): this;
|
|
496
503
|
|
|
497
504
|
/** Default options for this SchemaType */
|
|
498
|
-
defaultOptions: Record<string, any>;
|
|
505
|
+
static defaultOptions: Record<string, any>;
|
|
499
506
|
}
|
|
500
507
|
|
|
501
508
|
class Double extends SchemaType {
|
|
@@ -503,7 +510,7 @@ declare module 'mongoose' {
|
|
|
503
510
|
static schemaName: 'Double';
|
|
504
511
|
|
|
505
512
|
/** Default options for this SchemaType */
|
|
506
|
-
defaultOptions: Record<string, any>;
|
|
513
|
+
static defaultOptions: Record<string, any>;
|
|
507
514
|
}
|
|
508
515
|
|
|
509
516
|
class ObjectId extends SchemaType {
|
|
@@ -514,7 +521,7 @@ declare module 'mongoose' {
|
|
|
514
521
|
auto(turnOn: boolean): this;
|
|
515
522
|
|
|
516
523
|
/** Default options for this SchemaType */
|
|
517
|
-
defaultOptions: Record<string, any>;
|
|
524
|
+
static defaultOptions: Record<string, any>;
|
|
518
525
|
}
|
|
519
526
|
|
|
520
527
|
class Subdocument<DocType = unknown> extends SchemaType implements AcceptsDiscriminator {
|
|
@@ -525,7 +532,7 @@ declare module 'mongoose' {
|
|
|
525
532
|
schema: Schema;
|
|
526
533
|
|
|
527
534
|
/** Default options for this SchemaType */
|
|
528
|
-
defaultOptions: Record<string, any>;
|
|
535
|
+
static defaultOptions: Record<string, any>;
|
|
529
536
|
|
|
530
537
|
discriminator<T, U>(name: string | number, schema: Schema<T, U>, value?: string): U;
|
|
531
538
|
discriminator<D>(name: string | number, schema: Schema, value?: string): Model<D>;
|
|
@@ -559,7 +566,7 @@ declare module 'mongoose' {
|
|
|
559
566
|
uppercase(shouldApply?: boolean): this;
|
|
560
567
|
|
|
561
568
|
/** Default options for this SchemaType */
|
|
562
|
-
defaultOptions: Record<string, any>;
|
|
569
|
+
static defaultOptions: Record<string, any>;
|
|
563
570
|
}
|
|
564
571
|
|
|
565
572
|
class UUID extends SchemaType {
|
|
@@ -567,7 +574,7 @@ declare module 'mongoose' {
|
|
|
567
574
|
static schemaName: 'UUID';
|
|
568
575
|
|
|
569
576
|
/** Default options for this SchemaType */
|
|
570
|
-
defaultOptions: Record<string, any>;
|
|
577
|
+
static defaultOptions: Record<string, any>;
|
|
571
578
|
}
|
|
572
579
|
}
|
|
573
580
|
}
|