public function getTags()
{
$cmd['mapreduce'] = $this->_options['collection'];
$cmd['map'] = 'function(){
this.t.forEach(
function(z){
emit( z , { count : 1 } );
}
);
};';
$cmd['reduce'] = 'function( key , values ){
var total = 0;
for ( var i=0; i<values.length; i++ )
total += values[i].count;
return { count : total };
};';
$cmd['out'] = ['replace' => 'getTagsCollection'];
$res2 = $this->_db->command($cmd);
$res3 = $this->_db->selectCollection('getTagsCollection')->find();
$res = [];
foreach ($res3 as $key => $val) {
$res[] = $key;
}
$this->_db->dropCollection($res2['result']);
return $res;
}