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/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<MergeType<MergeType<TRawDocType, DocContents>, Require_id<TRawDocType>>>>;
339
+ ): Promise<Array<Require_id<DocContents>>>;
340
340
  insertMany<DocContents = TRawDocType>(
341
- doc: DocContents,
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<TRawDocType> & {
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
- HydratedDocument<
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<TRawDocType>>;
360
+ ): Promise<mongodb.InsertManyResult<Require_id<DocContents>>>;
362
361
  insertMany<DocContents = TRawDocType>(
363
362
  docs: Array<DocContents | TRawDocType>
364
- ): Promise<Array<HydratedDocument<MergeType<MergeType<TRawDocType, DocContents>, Require_id<TRawDocType>>, TVirtuals & TInstanceMethods, TQueryHelpers>>>;
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<MergeType<MergeType<TRawDocType, DocContents>, Require_id<TRawDocType>>>>;
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<TRawDocType>>;
371
+ ): Promise<mongodb.InsertManyResult<Require_id<DocContents>>>;
373
372
  insertMany<DocContents = TRawDocType>(
374
373
  doc: DocContents,
375
374
  options: InsertManyOptions
376
- ): Promise<Array<HydratedDocument<MergeType<MergeType<TRawDocType, DocContents>, Require_id<TRawDocType>>, TVirtuals & TInstanceMethods, TQueryHelpers>>>;
377
- insertMany<DocContents = TRawDocType>(doc: DocContents): Promise<
378
- Array<HydratedDocument<MergeType<MergeType<TRawDocType, DocContents>, Require_id<TRawDocType>>, TVirtuals & TInstanceMethods, TQueryHelpers>>
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 */
@@ -204,10 +204,10 @@ declare module 'mongoose' {
204
204
  * Model Statics methods.
205
205
  */
206
206
  statics?: IfEquals<
207
- TStaticMethods,
208
- {},
209
- Record<any, (this: Model<DocType>, ...args: any) => unknown>,
210
- TStaticMethods
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
  /**
@@ -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
- type FlatRecord<T> = { [K in keyof T]: T[K] };
22
+ type FlatRecord<T> = { [K in keyof T]: T[K] };
23
23
 
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>;
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.