Skip to content

Commit

Permalink
types: add skipValidation, strict, timestamps as options for bu…
Browse files Browse the repository at this point in the history
…lkWrite()

Fix #8778
  • Loading branch information
vkarpov15 committed Jan 2, 2024
1 parent c5fa9b4 commit e894fe8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,12 @@ declare module 'mongoose' {
toDrop: Array<any>
}

interface MongooseBulkWriteOptions {
skipValidation?: boolean;
strict?: boolean;
timestamps?: boolean | 'throw';
}

export const Model: Model<any>;
interface Model<T, TQueryHelpers = {}, TMethods = {}> extends NodeJS.EventEmitter, AcceptsDiscriminator {
new(doc?: AnyKeys<T> & AnyObject): EnforceDocument<T, TMethods>;
Expand All @@ -800,8 +806,8 @@ declare module 'mongoose' {
* if you use `create()`) because with `bulkWrite()` there is only one round
* trip to MongoDB.
*/
bulkWrite(writes: Array<any>, options?: mongodb.CollectionBulkWriteOptions): Promise<mongodb.BulkWriteOpResultObject>;
bulkWrite(writes: Array<any>, options?: mongodb.CollectionBulkWriteOptions, cb?: Callback<mongodb.BulkWriteOpResultObject>): void;
bulkWrite(writes: Array<any>, options?: mongodb.CollectionBulkWriteOptions & MongooseBulkWriteOptions): Promise<mongodb.BulkWriteOpResultObject>;
bulkWrite(writes: Array<any>, options?: mongodb.CollectionBulkWriteOptions & MongooseBulkWriteOptions, cb?: Callback<mongodb.BulkWriteOpResultObject>): void;

/**
* Sends multiple `save()` calls in a single `bulkWrite()`. This is faster than
Expand Down

0 comments on commit e894fe8

Please sign in to comment.