title: Call a function on each object in an array in Node
body: <p>I'm trying to batch together a database update to re-populate a mongo collection. I've created an object to hold the properties needed to lookup the data from an external source, and then add it back to a MongoDb collection.</p>
  
  <p>The array looks like this:</p>
  
  <pre><code>const pops = [ 
      { table: 'SFAccounts',
        label: 'Account__c', 
        createListName: 'Accounts'
      },
      { table: 'SFTimes',
        label: 'CusTime__c', 
        createListName: 'Time'
      }]
  </code></pre>
  
  <p>I want to then create a function that takes 'table', 'label, and 'createListName' and it does something basically like this..</p>
  
  <pre><code>async function processData(table, label, createListName) {
      // Get some info from Salesforce 
      const dataFromSF = await getMetaDataFromSalesForce(table)
      // Extract the parts I actually need
      const relevantBits = dataFromSF.filter(field =&gt; field.name === label)
      //Create a new list in the db
      const createResult = await List.create( { name: createListName, values: relevantBits } )
      return createResult
  }
  </code></pre>
  
  <p>The end goal is to get to something like</p>
  
  <pre><code>await Promise.all(processData(pops))
  </code></pre>
  
  <p>Which will await all the tables being pulled and populated into the database.</p>