2016-12-07 119 views
0

我需要設置爲MongoDBCodeigniter連接超時。 我config文件如何在CodeIgniter中設置MongoDB數據庫連接超時?

  $config['mongo_db']['active'] = 'default'; 
      $config['mongo_db']['default']['no_auth'] = FALSE; 
      $config['mongo_db']['default']['hostname'] = 'SHLY_DBSERVER'; 
      $config['mongo_db']['default']['port'] = '27018'; 
      $config['mongo_db']['default']['username'] = 'user'; 
      $config['mongo_db']['default']['password'] = '123'; 
      $config['mongo_db']['default']['database'] = 'testdb'; 
      $config['mongo_db']['default']['db_debug'] = TRUE; 
      $config['mongo_db']['default']['return_as'] = 'array'; 
      $config['mongo_db']['default']['write_concerns'] = (int)1; 
      $config['mongo_db']['default']['journal'] = TRUE; 
      $config['mongo_db']['default']['read_preference'] = NULL; 
      $config['mongo_db']['default']['read_preference_tags'] = NULL; 
      $config['mongo_db']['default']['no_auth'] = FALSE; 

有什麼辦法來設置從這裏選擇?

+0

對此問題http://forum.codeigniter.com/thread-63035看看。 html – styopdev

+0

CodeIgniter不提供MongoDB適配器。 – Narf

回答

1

它固定以下類似方式:

$config['mongo_db']['timeout'] = 100 or -1; 

否則檢查像上面的語法:

$cursor = $collection->find(); 
$cursor->timeout(-1);