first pass at breaking out the mongo aggregtion query, have it running independently of rails