How to make a correct aggregation request to an array to exclude an empty response

join shbcf.ru