Permalink
Browse files

Convert timeout option to connectTimeoutMS for driver >= 1.4.0

  • Loading branch information...
fmeynard authored and jmikola committed Sep 24, 2013
1 parent 03336c3 commit 1a7c268dab202b5ab0b57c8b343d2f84c27d12b9
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/Doctrine/MongoDB/Connection.php
@@ -276,6 +276,11 @@ public function initialize()
$server = $this->server ?: 'mongodb://localhost:27017';
$options = $this->options;
+ if (version_compare(phpversion('mongo'), '1.4.0', '>=') && isset($options['timeout'])) {
+ $options['connectTimeoutMS'] = $options['timeout'];
+ unset($options['timeout']);
+ }
+
$this->mongoClient = $this->retry(function() use ($server, $options) {
return version_compare(phpversion('mongo'), '1.3.0', '<')
? new \Mongo($server, $options)

0 comments on commit 1a7c268

Please sign in to comment.