So the actual schema is an array of services, with an array of apps, with an array of updates. I wanted to order the updates and group them together in a single apps object because I didn't simply wants hundreds of updates because of unwinding the updates... so heres what the shell ended up like (I'm using abbreviations and a larger schema, I just wanted to give this as an example to work with):
db.servers.aggregate( {$unwind:'$service'}, {$unwind:'$service.apps'}, {$unwind: '$service.apps.updates'}, {$sort:{'service.apps.updates.date':-1}}, {$group: {_id: '$_id', 'updates': {$push: '$service.apps.updates'}}}, {$project: {'service.apps.updates':'$updates'}} );
I thought this was an interesting thing to dive into and quite useful