Answer the question
In order to leave comments, you need to log in
Monga saves 600k records for almost a day?
There is a large array with data (sparged CSV) - approximately 600 records.
I save them like this
let count = 1;
for (const videoArray of parsed) {
console.log(count);
const videoData = {};
videoData.title = videoArray[1];
videoData.description = videoArray[2];
videoData.screenshot = videoArray[3];
videoData.tags = videoArray[4].split(',');
await videos.insertOne(videoData);
count++;
}
for...of
it was not necessary?
Answer the question
In order to leave comments, you need to log in
You save each record separately, and you also wait until each one is saved... Optimize: shove your parsed in chunks of 1000-5000 records at a time (depending on the size of the data).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question