From the course: Databases for Node.js Developers

Unlock this course with a free trial

Join today to access over 24,400 courses taught by industry experts.

Populating MongoDB with sample data

Populating MongoDB with sample data - Node.js Tutorial

From the course: Databases for Node.js Developers

Populating MongoDB with sample data

- [Instructor] To test the application and demonstrate queries, we need some data in our database. This is why we'll now populate MongoDB with sample data. We will load our sample data into the items collection using MongoDB Compass and I have it already open. So in simpleshop on items, I now click on Documents and they're on Add Data. And there I can now select input JSON or CSV file. So I click on that and the exercise files actually already contain a file for the sample data. So I'm now on my desktop and here I have the project folder. I click on it and here there is this folder sample-data. And there I have the sample-items chosen. I click on it and I click on Select. Then I click on Import. Now you see we imported 47 items. As I'm from Austria, I took the freedom to use AI to let it create just a set of somewhat typically Austrian products like the Mozartkugel or a Schnitzel, and Apfelstrudel. So you see it here. So each product has an id. This id is provided by MongoDB directly.…

Contents