names.forEach((o, i) => {
                Name.findOneAndUpdate({name: o.name}, o, {upsert: true, 'new': true})
                .then(result => {
                    res.json(result);
                })
            })
I cant do res.json in above's loop, how to do handle this case? I want to find name exist or not, if exist don't do anything, otherwise insert the names.
 
     
    