public function getGridFS($name = 'fs')
{
// return from pool
if ($this->collectionPoolEnabled && isset($this->collectionPool[$name])) {
return $this->collectionPool[$name];
}
// no object in pool - init new
$classDefinition = $this->getCollectionDefinition($name, array('gridfs' => true));
$className = $classDefinition->getClass();
// create collection class
$collection = new $className($this, $name, $classDefinition);
if (!$collection instanceof \Sokil\Mongo\GridFS) {
throw new Exception('Must be instance of \\Sokil\\Mongo\\GridFS');
}
// store to pool
if ($this->collectionPoolEnabled) {
$this->collectionPool[$name] = $collection;
}
// return
return $collection;
}