Adding multiple collection into one collection?

I have multiple collections for data related to a server. I am trying to add all the collection into one big collection as that will save the number of time I will have to query the database for data related to a server. I am thinking $lookup and $merge might be the way to go about it. However, I don’t have full knowledge of how to use $lookup and $merge yet. If I am going the wrong way about it or if you have a better way, do let know.

Or should I do it mannually?

If you got any questions do let me know.

Thank you in advance

Hello @Nirmal_Bhandari ,

Before we try to figure out if you should merge all the collections into one, can you please answer few questions?

  • The data in different collections is from different servers/applications or just one?
  • Initially, Why were different collections created at first place, why was not everything put in one collection? What was the benefit of this segregated data for you?
  • Are you trying to merge everything into one collection because of any constraint?

Regards,
Tarun

1 Like