Postgres Aggregate Functions In Mongodb