title: Using Sequilize and async/await to find/create records in Node.js in proper order
body: <p>I'm struggling to use Sequilize in Node.js correctly. I am reading in a large number of Orders, creating unique Customers from them, or updating Customers having multiple orders. So for each order first I find if the customer exists, create the customer if they don't, or update the customer if they do. But FindOne fails to find a new customer right after they are created, so the code ends up trying to create duplicate customers (which fail since customerId is required to be unique).</p>
  
  <p>I've verified new customers are being created in the database, just not in time for the FindOne() query to return. Is there something I should be doing to ensure new Customers are finished being written to the database before another FindOne query is executed? </p>
  
  <p>It appears that Node is piling up dozens of the async FindOne() queries at once, and executing the Create() for those orders only after the FindOne queries have finished for all of them.</p>
  
  <pre><code>     let customer =  await CustomerModel.findOne({
         where: { customerId: order.customerId }
       })
       if (customer == null) {
         await CustomerModel.create({
           customerId: order.customerId,
           reorders: 0
         });
       } else {
         customer.reorders += 1;
         await customer.save()
       }
     } catch (error) {
       console.log(
         "Customer could not be created for id: " + order.customerId + " :" + JSON.stringify(error)
       );
     }```
  
  </code></pre>