I'm asking you a question during Nodejs and MongoDB.

Asked 2 years ago, Updated 2 years ago, 118 views

Hello, I'm a student who is working on the project again after the midterm exam.

I'm working on NodeJs project and I'm trying to link it with mongodb using mongoose module.

For each iteration of the document, put the data in the form of json in the variable new Use save() of mongoose (ex.new.save()) I want to put it in mongoDB.

But the for statement seems to be asynchronous at the same time Maybe that's why I only have one and I can't go in anymore.

If you put the value in the variable new without using save(), and then float it to the console, you'll see that it's going in properly every iteration. ( ex. console.log(newnew) )

I couldn't find a solution at all, so I'm leaving a question

node.js mongodb mongoose

2022-09-22 22:02

1 Answers

I left a question a while ago due to an asynchronous problem, but I solved it with the module below. I don't know if it'll solve it, but please refer to it~

Async


2022-09-22 22:02

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.