title: How can I store MongoDB data to a javascript variable?
body: <pre><code>var liveJSON = [];
  Player.find({teamName: req.query.homeTeam}, function(err, foundHomePlayers){
      if (err) {
          console.log(err);
      } else {
          liveJSON = foundHomePlayers;    &lt;&lt;&lt;&lt;------ HERE!
      }
  });
  </code></pre>
  
  <p>I want to store MongoDB data (foundHomePlayers) to a javascript variable (liveJSON). But this syntax doesn't work? How can I store whole foundHomePlayers to a javascript variable?</p>