private function getCollection($type)
{
if ($this->collections[$type] === null) {
try {
$this->collections[$type] = $this->getMongoClient()->selectCollection($this->params['databaseName'], $type);
} catch (MongoException $e) {
throw new DatabaseException('Could not select collection', 500, $e);
}
}
return $this->collections[$type];
}