MongoDB migration

@turivishal, I am still understanding the parts. But this is exactly what I needed and works like a charm. This is how I am currently using it to copy data from one collection to another (I am using the function names you gave - but you get the idea … )

async function secondInsert() {
    source_data =  await firstInsert();
    source_data.forEach(async element => {
        let result = await SecondSchema.collection.insertOne(element);
        console.log(result)
    });
}

Thank you.

I will try to keep you posted on its development.

Regards,
Harsha

1 Like