Collating multiple Collection

Hi I have 3 Collections which are being updated by 3 independent process; one collection will have Source = A, 2nd will have Source = B and third one will have Source = C.
All Collections are of same Type and have same _Id Key Field (PolicyId+EndDate).

Now I want to create new collection out of these 3 Collections which will collate data (with some rules across different Source) across three collections and create one record for each PolicyId+EndDate with Source = Final. This “Collated” collection will have same _Id and same Type as original 3 collection.

What are my implementations options / approach ?

I am using on-premise Mongo DB and we are interacting with Mongo DB through C# Mongo Driver.

Thanks in Advance.
Mike

Hi @Marmik_Shah ,

It sounds like a use of $out aggregation and $merge consecutive interval updates should work.

To combine collections you can use stages like $lookup and $project to reshape.

Thanks
Pavel

Is this available through C# ?

Aggregations are performed by the server so they are available in all the drivers.

The version of the server will determine if it is available or not.

If you are used to program with language specific builders offer by some drivers, then you might need to update your driver to have access to the new builders. However, you can have access to the stage by building your pipeline in plain JSON and then parse it into the driver specific json structure.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.