Updating millions already existing documents

I am working on an updation pipeline, getting millions of rows of data each week, and I need to update new data of the respective document. The schema of each document is like an id and an array, and I need to search a particular id and append new data in an array. I am not able to optimize this.

Hey @Vaasu_Bisht,

Welcome to the MongoDB Community Forums! :leaves:

Can you please share some sample documents along with your current code? It is not clear if you have to append this a million times. Kindly provide a clearer use case description along with some examples. Also, do you need to update every document that has been inserted? If this is the case, why not try and do the modification before the insert?