Troubleshooting MongoDB Atlas Connection for Random NBA Player Data in a WordPress Sports Analytics App

Generate the players (run the for loop) before you connect to your DB, then insert in batches, I think inserting all 1000 at once might be the issue, instead, insert 50 (20 batches) or 100 (10 batches). Hope this helps.