/**
  * Create a couchdb connection.
  *
  * @param array $connectionData Connection information
  *
  * @return [type] [description]
  */
 public function createConnection($connectionData)
 {
     //now we change the default values for the ones the user configured
     $default_config = ['database' => '', 'host' => 'localhost', 'port' => 5984, 'username' => null, 'password' => null, 'ip' => null, 'ssl' => false, 'models_dir' => app_path(), 'lucene_handler_name' => '_fti', 'proxies_dir' => app_path() . 'storage' . DIRECTORY_SEPARATOR . 'proxies', 'keep-alive' => true, 'timeout' => '0.01', 'views_folder' => '../app/couchdb', 'viewsname' => 'couchsource'];
     $config = array_replace_recursive($default_config, $connectionData);
     $databaseName = $config['database'];
     $documentPaths = array($config['models_dir']);
     $httpClient = new \Doctrine\CouchDB\HTTP\SocketClient($config['host'], $config['port'], $config['username'], $config['password'], $config['ip'], $config['ssl']);
     $httpClient->setOption('keep-alive', $config['keep-alive']);
     $configManager = new \Doctrine\ODM\CouchDB\Configuration();
     $this->metadataDriver = new AnnotationDriver(new AnnotationReader(), $documentPaths);
     // registering noop annotation autoloader - allow all annotations by default
     AnnotationRegistry::registerLoader('class_exists');
     $configManager->setProxyDir($config['proxies_dir']);
     $configManager->setMetadataDriverImpl($this->metadataDriver);
     $configManager->setLuceneHandlerName($config['lucene_handler_name']);
     $connection = new \Doctrine\CouchDB\CouchDBClient($httpClient, $databaseName);
     $view = new FolderDesignDocument($config['views_folder']);
     $connection->createDesignDocument($config['viewsname'], $view);
     $this->dm = new \Doctrine\ODM\CouchDB\DocumentManager($connection, $configManager);
 }