@@ -411,8 +411,7 @@ const methods = {
411
411
addToSet ( ) {
412
412
_checkManualPopulation ( this , arguments ) ;
413
413
414
- let values = [ ] . map . call ( arguments , this . _mapCast , this ) ;
415
- values = this [ arraySchemaSymbol ] . applySetters ( values , this [ arrayParentSymbol ] ) ;
414
+ const values = [ ] . map . call ( arguments , this . _mapCast , this ) ;
416
415
const added = [ ] ;
417
416
let type = '' ;
418
417
if ( values [ 0 ] instanceof ArraySubdocument ) {
@@ -423,7 +422,7 @@ const methods = {
423
422
type = 'ObjectId' ;
424
423
}
425
424
426
- const rawValues = utils . isMongooseArray ( values ) ? values . __array : this ;
425
+ const rawValues = utils . isMongooseArray ( values ) ? values . __array : values ;
427
426
const rawArray = utils . isMongooseArray ( this ) ? this . __array : this ;
428
427
429
428
rawValues . forEach ( function ( v ) {
@@ -690,10 +689,7 @@ const methods = {
690
689
691
690
_checkManualPopulation ( this , values ) ;
692
691
693
- const parent = this [ arrayParentSymbol ] ;
694
692
values = [ ] . map . call ( values , this . _mapCast , this ) ;
695
- values = this [ arraySchemaSymbol ] . applySetters ( values , parent , undefined ,
696
- undefined , { skipDocumentArrayCast : true } ) ;
697
693
let ret ;
698
694
const atomics = this [ arrayAtomicsSymbol ] ;
699
695
this . _markModified ( ) ;
@@ -925,7 +921,6 @@ const methods = {
925
921
values = arguments ;
926
922
} else {
927
923
values = [ ] . map . call ( arguments , this . _cast , this ) ;
928
- values = this [ arraySchemaSymbol ] . applySetters ( values , this [ arrayParentSymbol ] ) ;
929
924
}
930
925
931
926
const arr = utils . isMongooseArray ( this ) ? this . __array : this ;
0 commit comments