title: wait findOneAndUpdate in a loop end
body: <pre><code>names.forEach((o, i) =&gt; {
                  Name.findOneAndUpdate({name: o.name}, o, {upsert: true, 'new': true})
                  .then(result =&gt; {
                      res.json(result);
                  })
              })
  </code></pre>
  
  <p>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.</p>