This really looks like you are asking to modify one document only, but where you are presently looping updates you do not need to do that.
Also you are asking for the modified result, which actually belongs to methods like .findOneAndUpdate(), as that form returns the modified document. The .update() form which can be applied to multiple documents and therefore does not return the modified contents in the result:
So it really looks like rather than looping, then all you need to do is "re-shape" your input array:
var array = ["Tennis","Football"];
array = array.map(function(x) {
return { "name": x };
});
// array is now [{ "name": "Tennis" }, { "name": "Football" }]
Talent.findOneAndUpdate(
{ "userName": userName },
{
"$addToSet": { "skills": { "$each": array } }
},
function(err,doc) {
if (err) throw err;
// doc contains all array members added
console.log( JSON.stringify( doc, undefined, 4) );
callback(); // Your outer callback
}
);
The $each modifier takes an array argument in the last case, so it is just a matter of re-shaping your input arguments in the original array to match the structure expected when updating the actual document.
There are other ways of dealing with performing the looping in series, but it would seem that in this case you do not need it.