Passing array name as parameters in mongoose

I'm using mongoose and I'm doing an update of my db by using findByIdAndUpdate() function. I'd like to push elements into different arrays present in my document. I have in my document different array with different names. May I pass as parameter the name array to this function or I should create different function where every function has a different nameArray?

  this.findByIdAndUpdate(User._id,
                        {$push:{nameArray: 'element'}}, 
                        {upsert: true},
                        callback);

Build your $push object programmatically:

var push = {};
push[nameArray] = 'element';
this.findByIdAndUpdate(User._id,
                       {$push: push}, 
                       {upsert: true},
                       callback);