I have my asset documents in the below format.
db.asset.find({}).limit(1).pretty() { \"_id\" : ObjectId(\"54e650a10364a65f62c0df4a\"), \"_class\" :
You first need to unwind by the folderIds field, than group by _id and push the asset _id into a list assets_id.
folderIds
_id
assets_id
db.asset.aggregate([{$unwind:"$folderIds"}, {$group:{_id: "$folderIds",assets:{$push: {assets_id:"$_id"}}}}])