From the course: Databases for Node.js Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Insert data into MongoDB

Insert data into MongoDB

From the course: Databases for Node.js Developers

Start my 1-month free trial

Insert data into MongoDB

- [Narrator] Now we are going to fetch the data from the API and insert it into Mongo DB and always when working with APIs, it makes sense to actually look at the date that we will get back and I already did this by just calling the API without the start and the end date this will give me the last seven days, so that's long enough to understand the structure in that just copy that, returned from the API and in vicious to the code. I will just create a new file data.Jason, to when I save it, then I get formatting and then I see how this data actually looks like. We see that we have a property PPI so this property PPI contains a list of dates and the intercourse for this date. And we want to create an entry for each date so a new document in our database for each date. So let's implement that in my Mongo back end chess, I now scroll down to the insert method and there I start with just fetching the data from the API so at…

Contents