Create mongodb database using another mongodb in node red

Hi Guys,
We have one large database in mongoDB and we would like to create a summary mongoDB database based on the large database using Node-red. Can anyone help to achieve this please?

thanks in advance,

Hello ..

you can try using the node-red-node-mongodb node which is the most recently updated mongodb node.
then do an aggregation pipeline search to create the summary of you main db collection with an additional stage at the end of the aggregation :

{ $out: { db: "<output-db>", coll: "<output-collection>" } }

$out stage example

$out documentation

Thanks UnborN for your reply,
I dont think aggregation will work in my case. I will explain more detail about my requirement.
I have thousands of mongoDB documents in a collection. These documents are creating each minute/hour/seconds with creation time stamp. I would like to create a new database in mongoDB with the fields like start time stamp, end time stamp, month, year for each month.

Challenge number one is, how do i find the start time stamp & end time stamp in a month from the thousands of documents.
Challenge number two is i need to find the start time stamp and end time stamp for each month like January, February, etc.
Then insert the fields to new mongoDB database.

thanks in advance

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