Insertion N elements to an array in MongoD whit References or controllator

Hi guys,

I need your help in fitting an insert of arrays of N Quantity to a field, from my controller.

Let me explain, I would like to be able to push to a field N record amount of an Array, I have tried to modify my schema with references of this type

field: [SchemaReference]

but since it is in different schemas I cannot, and what I want to do is to be able to save as much user mails as possible in a group, so that all of them can have a view of the message. this is my controller

saveGroup : function (req, res) {

        //recoger parametros por post

        var params= req.body;

        //validar datos

        try{

            var validate_nameChat = !validator.isEmpty(params.nameChat);

            var validate_email = !validator.isEmpty(params.email);          

        }catch(err){

                return  res.status(404).send({

                    message:'faltan datos por enviar // Save', 

            });

        }

        

        if(validate_nameChat && validate_email){

        //crear objeto a guardar 

            var group = new Group();

        //asignar valores

            group.nameChat = params.nameChat;

            group.user = req.user.sub;

            group.email = params.email;

            //group.urlFile=null;

            var contacts = {

                user: req.user.sub,

                email: req.body.email,

            };

            group.email.push(contacts);

        //guardar topic

            group.save((err, groupStored) =>{

        //devolver una respuesta 

        console.log(groupStored);

        //console.log(groupStored);

                if (err || !groupStored) {

                    

                    return  res.status(404).send({

                        status:'error',

                        message:'Ya el tienes un chat con el usuario que quieres agregar'
                    });
                }
                return res.status(200).send({
                    status:'succes',
                    groupStored
                });
            });
        }else{
            return res.status(404).send({
                message:'Los datos no son Validos'
            });
        }
    },

the schema is as follows

var Schema = mongoose.Schema;

var MessageSchema =  new Schema({

    messageContent:{ type:String },

    //idStatusMessage:{ type:Boolean },

    user :{ type: Schema.ObjectId, ref:'User'},

    urlFile:{ type:String, default:'Image.png'},

},{     versionKey:false,

        timestamps:true, 

});

var Message = mongoose.model('Message' ,MessageSchema);

var GroupsSchema =  new Schema({

    nameChat:{ type:String },

    user :{type: Schema.Types.ObjectId, ref:'User'}, 

    //contact:[ContactSchema] 

    email:[ { type:String, unique:true, trim:true, require:true}],

    messages:[MessageSchema] 

},{     versionKey:false,

        timestamps:true,      

});

//cargar grupos

GroupsSchema.plugin(mongoosePaginate);

module.exports  = mongoose.model('Group',  GroupsSchema);

I found this kind of documentation {$ push: {field: {$ each: [element1, element2, …, elementN}}}
that could help me but I can’t find a way to apply it to be able to add different emails in the group

let say you have user schema:

{
    _id: objectId,
    userName: string,
    emails:[
        {
            type: string,
            emailaddress:string
        }
    ]
}
var emailListArr = [
    {
        type: string,
        emailaddress:string1
    },
    {
        type: string,
        emailaddress:string2
    },
    {
        type: string,
        emailaddress:string3
    }
]

now you want to add 3 emails from emailListArr to user then your update will be like below:

db.user.update({_id: objectId},{
    {$push:{emails: {$each:emailListArr }}}
})

Please note: i have shared mongo shell queries you need to have equivalent queries for nodejs/mongoose