I am writing a function that updates an array outside the scope of the function and the array does not update with the new values added
  var eventArray = [];
  function findStuff(){
    query.find({
      success: function(results) {
        for (var i = 0; i < results.length; i++) {
          var eventObject = {};
          eventObject["id"] = results[i].id
          eventObject["name"] = results[i].get("name")
          eventArray.push(eventObject)
          console.log(eventObject)
      }
      eventArray = JSON.stringify({ "data":eventArray})
      console.log(eventArray)
      },
        error: function(error) {
        console.log("Error: " + error.code + " " + error.message);
      }
    });
  }
  findStuff();
  console.log(JSON.stringify({ "data":eventArray}))
