use .aggregate() instead of raw SQL query