Answer the question
In order to leave comments, you need to log in
How to save multiple documents in mongoose with one command?
Several documents need to be saved. What is the best way to do this?
1) Run a loop and save asynchronously? In this case, I don't like that I have to make many requests at the same time.
2) Save each document separately, but in turn? Again, many requests.
3) Or is there a way to initiate a lot of new Model{}, push them into an array and somehow send them to the database with one command?
What do you advise?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question