Postgres Aggregate Functions In Mongodb Data