mongoose 7.3.1 → 7.3.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/.eslintrc.js +3 -1
- package/.markdownlint-cli2.cjs +69 -0
- package/README.md +24 -25
- package/dist/browser.umd.js +1 -1
- package/lib/connection.js +1 -2
- package/lib/cursor/QueryCursor.js +22 -14
- package/lib/document.js +25 -10
- package/lib/helpers/populate/getModelsMapForPopulate.js +2 -1
- package/lib/helpers/populate/getSchemaTypes.js +10 -14
- package/lib/index.js +2 -4
- package/lib/model.js +20 -15
- package/lib/query.js +21 -1
- package/lib/schema.js +10 -10
- package/lib/types/array/methods/index.js +3 -0
- package/package.json +16 -15
- package/types/index.d.ts +28 -21
- package/types/models.d.ts +17 -16
- package/types/schemaoptions.d.ts +4 -4
- package/types/utility.d.ts +8 -8
package/types/models.d.ts
CHANGED
|
@@ -336,46 +336,47 @@ declare module 'mongoose' {
|
|
|
336
336
|
insertMany<DocContents = TRawDocType>(
|
|
337
337
|
docs: Array<DocContents | TRawDocType>,
|
|
338
338
|
options: InsertManyOptions & { lean: true; }
|
|
339
|
-
): Promise<Array<
|
|
339
|
+
): Promise<Array<Require_id<DocContents>>>;
|
|
340
340
|
insertMany<DocContents = TRawDocType>(
|
|
341
|
-
|
|
341
|
+
docs: DocContents | TRawDocType,
|
|
342
|
+
options: InsertManyOptions & { lean: true; }
|
|
343
|
+
): Promise<Array<Require_id<DocContents>>>;
|
|
344
|
+
insertMany<DocContents = TRawDocType>(
|
|
345
|
+
doc: DocContents | TRawDocType,
|
|
342
346
|
options: InsertManyOptions & { ordered: false; rawResult: true; }
|
|
343
|
-
): Promise<mongodb.InsertManyResult<
|
|
347
|
+
): Promise<mongodb.InsertManyResult<Require_id<DocContents>> & {
|
|
344
348
|
mongoose: {
|
|
345
349
|
validationErrors: Error[];
|
|
346
350
|
results: Array<
|
|
347
351
|
Error |
|
|
348
352
|
Object |
|
|
349
|
-
|
|
350
|
-
MergeType<
|
|
351
|
-
MergeType<TRawDocType, DocContents>,
|
|
352
|
-
Require_id<TRawDocType>
|
|
353
|
-
>
|
|
354
|
-
>
|
|
353
|
+
MergeType<THydratedDocumentType, DocContents>
|
|
355
354
|
>
|
|
356
355
|
}
|
|
357
356
|
}>;
|
|
358
357
|
insertMany<DocContents = TRawDocType>(
|
|
359
358
|
docs: Array<DocContents | TRawDocType>,
|
|
360
359
|
options: InsertManyOptions & { rawResult: true; }
|
|
361
|
-
): Promise<mongodb.InsertManyResult<
|
|
360
|
+
): Promise<mongodb.InsertManyResult<Require_id<DocContents>>>;
|
|
362
361
|
insertMany<DocContents = TRawDocType>(
|
|
363
362
|
docs: Array<DocContents | TRawDocType>
|
|
364
|
-
): Promise<Array<
|
|
363
|
+
): Promise<Array<MergeType<THydratedDocumentType, Omit<DocContents, '_id'>>>>;
|
|
365
364
|
insertMany<DocContents = TRawDocType>(
|
|
366
365
|
doc: DocContents,
|
|
367
366
|
options: InsertManyOptions & { lean: true; }
|
|
368
|
-
): Promise<Array<
|
|
367
|
+
): Promise<Array<Require_id<DocContents>>>;
|
|
369
368
|
insertMany<DocContents = TRawDocType>(
|
|
370
369
|
doc: DocContents,
|
|
371
370
|
options: InsertManyOptions & { rawResult: true; }
|
|
372
|
-
): Promise<mongodb.InsertManyResult<
|
|
371
|
+
): Promise<mongodb.InsertManyResult<Require_id<DocContents>>>;
|
|
373
372
|
insertMany<DocContents = TRawDocType>(
|
|
374
373
|
doc: DocContents,
|
|
375
374
|
options: InsertManyOptions
|
|
376
|
-
): Promise<Array<
|
|
377
|
-
insertMany<DocContents = TRawDocType>(
|
|
378
|
-
|
|
375
|
+
): Promise<Array<MergeType<THydratedDocumentType, Omit<DocContents, '_id'>>>>;
|
|
376
|
+
insertMany<DocContents = TRawDocType>(
|
|
377
|
+
doc: DocContents
|
|
378
|
+
): Promise<
|
|
379
|
+
Array<MergeType<THydratedDocumentType, Omit<DocContents, '_id'>>>
|
|
379
380
|
>;
|
|
380
381
|
|
|
381
382
|
/** The name of the model */
|
package/types/schemaoptions.d.ts
CHANGED
|
@@ -204,10 +204,10 @@ declare module 'mongoose' {
|
|
|
204
204
|
* Model Statics methods.
|
|
205
205
|
*/
|
|
206
206
|
statics?: IfEquals<
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
207
|
+
TStaticMethods,
|
|
208
|
+
{},
|
|
209
|
+
{ [name: string]: (this: Model<DocType>, ...args: any[]) => unknown },
|
|
210
|
+
{ [F in keyof TStaticMethods]: TStaticMethods[F] }
|
|
211
211
|
>
|
|
212
212
|
|
|
213
213
|
/**
|
package/types/utility.d.ts
CHANGED
|
@@ -19,15 +19,15 @@ declare module 'mongoose' {
|
|
|
19
19
|
* @description It makes intellisense dialog box easier to read as a single object instead of showing that in multiple object unions.
|
|
20
20
|
* @param {T} T The type to be converted.
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
type FlatRecord<T> = { [K in keyof T]: T[K] };
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
type IsItRecordAndNotAny<T> = IfEquals<T, any, false, T extends Record<any, any> ? true : false>;
|
|
24
|
+
/**
|
|
25
|
+
* @summary Checks if a type is "Record" or "any".
|
|
26
|
+
* @description It Helps to check if user has provided schema type "EnforcedDocType"
|
|
27
|
+
* @param {T} T A generic type to be checked.
|
|
28
|
+
* @returns true if {@link T} is Record OR false if {@link T} is of any type.
|
|
29
|
+
*/
|
|
30
|
+
type IsItRecordAndNotAny<T> = IfEquals<T, any, false, T extends Record<any, any> ? true : false>;
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* @summary Checks if two types are identical.
|