课程: Databases for Node.js Developers (2021)

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Insert data into MongoDB

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…

内容