title: MongoDB bulkWrite multiple updateOne vs updateMany
body: <p>I have cases where I build bulkWrite operations where some documents have the same <code>update</code> object, is there any performance benefit to merging the filters and send one <code>updateMany</code> with those filters instead of multiple <code>updateOne</code>s in the same <code>bulkWrite</code>?</p>
  <p>It's obviously better to use <code>updateMany</code> over multiple <code>updateOne</code>s when using the normal methods, but with bulkWrite, since it's a single command, are there any significant gains of preferring one over the other?</p>
  <p><strong>Example:</strong></p>
  <p>I have 200k documents that I need to update, I have 10 total unique <code>status</code> field for all 200K documents, so my options are:</p>
  <p><strong>Solutions:</strong></p>
  <p><strong>A)</strong> Send one single bulkWrite with 10 <code>updateMany</code> operations, and each one of those operations will affect 20K documents.</p>
  <p><strong>B)</strong> Send one single bulkWrite with 200K <code>updateOne</code> each operations holding its filter and <code>status</code>.</p>
  <p>As @AlexBlex noted, I have to look out for accidentally updating more than one document with the same filter, in my case I use <code>_id</code> as my filter, so accidentally updating other documents is not a concern in my case, but is definitely something to look out for when considering the <code>updateMany</code> option.</p>
  <p>Thanks @AlexBlex.</p>