I don’t know if this is relevant, but this aggregation is performed immediately after another aggregation on the same collection.
files.aggregate([ {
$match : {
'metadata.type' : 'captcha',
'metadata.expiration' : {
$lte : new Date()
}
}
}, {
$group : {
_id : 0,
files : {
$push : '$filename'
}
}