@@ -118,7 +118,9 @@ module.exports.castUpdateOne = function castUpdateOne(originalModel, updateOne,
118118 if ( model . schema . $timestamps != null && doInitTimestamps ) {
119119 const createdAt = model . schema . $timestamps . createdAt ;
120120 const updatedAt = model . schema . $timestamps . updatedAt ;
121- applyTimestampsToUpdate ( now , createdAt , updatedAt , update , { } ) ;
121+ applyTimestampsToUpdate ( now , createdAt , updatedAt , update , {
122+ timestamps : updateOne . timestamps
123+ } ) ;
122124 }
123125
124126 if ( doInitTimestamps ) {
@@ -150,7 +152,8 @@ module.exports.castUpdateOne = function castUpdateOne(originalModel, updateOne,
150152 strict : strict ,
151153 upsert : updateOne . upsert ,
152154 arrayFilters : updateOne . arrayFilters ,
153- overwriteDiscriminatorKey : updateOne . overwriteDiscriminatorKey
155+ overwriteDiscriminatorKey : updateOne . overwriteDiscriminatorKey ,
156+ overwriteImmutable : updateOne . overwriteImmutable
154157 } , model , updateOne [ 'filter' ] ) ;
155158
156159 return updateOne ;
@@ -185,7 +188,9 @@ module.exports.castUpdateMany = function castUpdateMany(originalModel, updateMan
185188 if ( model . schema . $timestamps != null && doInitTimestamps ) {
186189 const createdAt = model . schema . $timestamps . createdAt ;
187190 const updatedAt = model . schema . $timestamps . updatedAt ;
188- applyTimestampsToUpdate ( now , createdAt , updatedAt , updateMany [ 'update' ] , { } ) ;
191+ applyTimestampsToUpdate ( now , createdAt , updatedAt , updateMany [ 'update' ] , {
192+ timestamps : updateMany . timestamps
193+ } ) ;
189194 }
190195 if ( doInitTimestamps ) {
191196 applyTimestampsToChildren ( now , updateMany [ 'update' ] , model . schema ) ;
@@ -208,7 +213,8 @@ module.exports.castUpdateMany = function castUpdateMany(originalModel, updateMan
208213 strict : strict ,
209214 upsert : updateMany . upsert ,
210215 arrayFilters : updateMany . arrayFilters ,
211- overwriteDiscriminatorKey : updateMany . overwriteDiscriminatorKey
216+ overwriteDiscriminatorKey : updateMany . overwriteDiscriminatorKey ,
217+ overwriteImmutable : updateMany . overwriteImmutable
212218 } , model , updateMany [ 'filter' ] ) ;
213219} ;
214220
0 commit comments