@@ -23,13 +23,21 @@ declare module 'mongoose' {
2323 ) : U ;
2424 }
2525
26- interface MongooseBulkWriteOptions {
26+ interface MongooseBulkWriteOptions extends mongodb . BulkWriteOptions {
27+ session ?: ClientSession ;
2728 skipValidation ?: boolean ;
2829 throwOnValidationError ?: boolean ;
29- timestamps ?: boolean ;
3030 strict ?: boolean | 'throw' ;
3131 }
3232
33+ interface MongooseBulkSaveOptions extends mongodb . BulkWriteOptions {
34+ timestamps ?: boolean ;
35+ session ?: ClientSession ;
36+ }
37+
38+ /**
39+ * @deprecated use AnyBulkWriteOperation instead
40+ */
3341 interface MongooseBulkWritePerWriteOptions {
3442 timestamps ?: boolean ;
3543 strict ?: boolean | 'throw' ;
@@ -200,6 +208,8 @@ declare module 'mongoose' {
200208 hint ?: mongodb . Hint ;
201209 /** When true, creates a new document if no document matches the query. */
202210 upsert ?: boolean ;
211+ /** When false, do not add timestamps. */
212+ timestamps ?: boolean ;
203213 }
204214
205215 export interface UpdateManyModel < TSchema = AnyObject > {
@@ -215,6 +225,8 @@ declare module 'mongoose' {
215225 hint ?: mongodb . Hint ;
216226 /** When true, creates a new document if no document matches the query. */
217227 upsert ?: boolean ;
228+ /** When false, do not add timestamps. */
229+ timestamps ?: boolean ;
218230 }
219231
220232 export interface DeleteOneModel < TSchema = AnyObject > {
@@ -281,19 +293,19 @@ declare module 'mongoose' {
281293 */
282294 bulkWrite < DocContents = TRawDocType > (
283295 writes : Array < AnyBulkWriteOperation < DocContents extends Document ? any : ( DocContents extends { } ? DocContents : any ) > > ,
284- options : mongodb . BulkWriteOptions & MongooseBulkWriteOptions & { ordered : false }
296+ options : MongooseBulkWriteOptions & { ordered : false }
285297 ) : Promise < mongodb . BulkWriteResult & { mongoose ?: { validationErrors : Error [ ] } } > ;
286298 bulkWrite < DocContents = TRawDocType > (
287299 writes : Array < AnyBulkWriteOperation < DocContents extends Document ? any : ( DocContents extends { } ? DocContents : any ) > > ,
288- options ?: mongodb . BulkWriteOptions & MongooseBulkWriteOptions
300+ options ?: MongooseBulkWriteOptions
289301 ) : Promise < mongodb . BulkWriteResult > ;
290302
291303 /**
292304 * Sends multiple `save()` calls in a single `bulkWrite()`. This is faster than
293305 * sending multiple `save()` calls because with `bulkSave()` there is only one
294306 * network round trip to the MongoDB server.
295307 */
296- bulkSave ( documents : Array < Document > , options ?: mongodb . BulkWriteOptions & { timestamps ?: boolean } ) : Promise < mongodb . BulkWriteResult > ;
308+ bulkSave ( documents : Array < Document > , options ?: MongooseBulkSaveOptions ) : Promise < mongodb . BulkWriteResult > ;
297309
298310 /** Collection the model uses. */
299311 collection : Collection ;
0 commit comments