/** * Aggregation Helper */ public function aggregate($pipeline) { $pipeline_object = new Pipeline($pipeline, $this); $pipeline_object->compress(); return $this->db->command(array('aggregate' => $this->name, 'pipeline' => $pipeline_object->compressed)); }