Video Transcript (English)
In this unit, you learned what a MongoDB driver is and how to connect the MongoDB database to a Node.js application by using the driver. You also learned how to troubleshoot common connection errors.
When we run a Node.js application that connects to MongoDB, the application requires a set of libraries to interact with our MongoDB instance.
These libraries are referred to as drivers. MongoDB provides a Node.js driver for asynchronous application code.
Before we connected our application to our Atlas cluster, we first had to install the MongoDB driver by using the npm package manager.
After installing the driver, we used our connection string from Atlas to create a connection between our application and database.
We used a single MongoClient instance because creating MongoClients is resource intensive.
Creating a new MongoClient for each database request will lead to performance degradation.
Finally, you learned how to troubleshoot common connection issues, such as: Network access errors and user authentication errors.
This knowledge gives you the foundation to troubleshoot the most common connection problems.
Now that you can successfully connect your database to your Node.js application by using a connection string, try implementing CRUD methods and performing aggregations.
To do this, check out our units on CRUD, or take a look at the MongoDB documentation.
Congratulations on completing this unit. Until next time, keep coding!
