protected function findLastVersion(Stage $qa)
    {
        $elementName = 'node';
        $qa->sort(array('createdAt' => 1));
        $qa->group(array(
            '_id' => array('nodeId' => '$nodeId'),
            $elementName => array('$last' => '$$ROOT')
        ));

        return $this->hydrateAggregateQuery($qa, $elementName, 'getNodeId');
    }
protected function findLastVersion(Stage $qa)
    {
        $elementName = 'node';
        $qa->sort(array('createdAt' => 1));
        $qa->group(array(
            '_id' => array('nodeId' => '$nodeId'),
            $elementName => array('$last' => '$$ROOT')
        ));

        return $this->hydrateAggregateQuery($qa, $elementName, 'getNodeId');
    }
@param Stage $qa

@return array