title: Mongodb 4.0 bulkWrite is extremely slow while updating
body: <p>I have a collection with more than 1 million user, I'm trying to update 
  users balance on some event. </p>
  
  <p>while I'm trying to update e.g. 299 row it takes up to 15739.901ms</p>
  
  <p>no high load on the sever, it's just mongo running. I'm storing the database on an SSD Samsung evo 860 but MongoDB installed on an HDD. </p>
  
  <p>Here's my function:</p>
  
  <pre><code>async usersUpdate(usersToUpdate){
  const updates = [];
     return new Promise(async (resolve, reject) =&gt; {
         users.forEach(user=&gt;{
  
              updates.push(
                 { "updateOne": {
                      "filter": { "userID": user.userID, 'balance':user.userBalance },
                      "update": { "$set": { "user.$.userBalance": user.newBalance } , "$addToSet":{'orders.$.orderID':user.OrderID} }
                  }
  
                 });
  
         }
  
  
         console.log('total updates' , updates.length);
         if (updates.length &gt; 0){
             const DbConnection = await getConnection();
             const usersTable = DbConnection.collection('usersCollection');
             transactionsTable.bulkWrite(updates, {"ordered": false, writeConcern : { w : 0 } }, function(err, result) {
                 // do something with result
                 if (err) return reject(err);
                 return resolve(result)
  
             });
         }else{
             return resolve('Nothing to update');
         }
     });
  }
  </code></pre>
  
  <p>both userID and userBalance are indexed, and I set <code>writeconcern</code> equals to false.</p>
  
  <p>I don't know what's the wrong with code and why it's super slow. </p>
  
  <p>What's the problem and how could I speed up the progress a bit? </p>
  
  <p>Mongodb config file: </p>
  
  <pre><code>storage:
    dbPath: "/ssd/mongodb"
    journal:
      enabled: false
  </code></pre>
  
  <p>Explain result:</p>
  
  <pre><code>{ queryPlanner: 
     { plannerVersion: 1,
       namespace: 'usersDB.usersCollection',
       indexFilterSet: false,
       parsedQuery: 
        { '$and': 
           [ { userID: 
                { '$eq': 'Kfasg3ffasg' } },
             { 'user.userBalance': { '$eq': 10 } } ] },
       winningPlan: 
        { stage: 'FETCH',
          filter: { 'user.userBalance': { '$eq': 10 } },
          inputStage: 
           { stage: 'IXSCAN',
             keyPattern: { userID: 1 },
             indexName: 'userID_1',
             isMultiKey: false,
             multiKeyPaths: { userID: [] },
             isUnique: true,
             isSparse: false,
             isPartial: false,
             indexVersion: 2,
             direction: 'forward',
             indexBounds: 
              { userID: 
                 [ '["Kfasg3ffasg", "Kfasg3ffasg"]' ] } } },
       rejectedPlans: [] },
    executionStats: 
     { executionSuccess: true,
       nReturned: 1,
       executionTimeMillis: 24,
       totalKeysExamined: 1,
       totalDocsExamined: 1,
       executionStages: 
        { stage: 'FETCH',
          filter: { 'user.userBalance': { '$eq': 10 } },
          nReturned: 1,
          executionTimeMillisEstimate: 0,
          works: 2,
          advanced: 1,
          needTime: 0,
          needYield: 0,
          saveState: 0,
          restoreState: 0,
          isEOF: 1,
          invalidates: 0,
          docsExamined: 1,
          alreadyHasObj: 0,
          inputStage: 
           { stage: 'IXSCAN',
             nReturned: 1,
             executionTimeMillisEstimate: 0,
             works: 2,
             advanced: 1,
             needTime: 0,
             needYield: 0,
             saveState: 0,
             restoreState: 0,
             isEOF: 1,
             invalidates: 0,
             keyPattern: { userID: 1 },
             indexName: 'userID_1',
             isMultiKey: false,
             multiKeyPaths: { userID: [] },
             isUnique: true,
             isSparse: false,
             isPartial: false,
             indexVersion: 2,
             direction: 'forward',
             indexBounds: 
              { userID: 
                 [ '["Kfasg3ffasg", "Kfasg3ffasg"]' ] },
             keysExamined: 1,
             seeks: 1,
             dupsTested: 0,
             dupsDropped: 0,
             seenInvalidated: 0 } },
       allPlansExecution: [] },
    serverInfo: 
     {  }
  </code></pre>