Change output Data format by Aggregation

My Aggregation

Output from aggregation

But I need data in that format

how can I do that?

You can use the present output as input to the following pipeline and get the desired output (add this pipeline to your present aggregation):

                "$addFields" : {
                        "" : "$author"
                "$replaceRoot" : {
                        "newRoot" : "$feeds"

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