i have already a collection of documents like this way:
{"name": "apple", "cnt": 10}
{"name": "orange", "cnt": 15}
{"name": "banana", "cnt": 12}
{"name": "grapefruit", "cnt": 2}
i want to transform them into an array of documents and that should look like this:
[
{"name": "apple", "cnt": 10},
{"name": "orange", "cnt": 15},
{"name": "banana", "cnt": 12},
{"name": "grapefruit", "cnt": 2}
]
Any suggestions on how can i do it? Thank in you in advance
EDIT
Mongo group and push: pushing all fields
i already tried the push editor
{ $group : {fish: { $push : "$$ROOT" }}}
but in vain