Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- Switch from using depricated connect = true option to manually inv…

…oking connect()

 - Provide configuration ability for readPrefernce options
  • Loading branch information...
commit 7b4134892c865679794c09c48e346f1c48dc5fc1 1 parent 96bb832
@preinheimer authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 data/source/MongoDb.php
View
8 data/source/MongoDb.php
@@ -239,7 +239,6 @@ public function connect() {
$connection = "mongodb://{$login}{$host}" . ($login ? "/{$cfg['database']}" : '');
$options = array(
- 'connect' => true,
'timeout' => $cfg['timeout'],
'replicaSet' => $cfg['replicaSet']
);
@@ -249,7 +248,12 @@ public function connect() {
$options['persist'] = $persist === true ? 'default' : $persist;
}
$this->server = new Mongo($connection, $options);
-
+ $this->server->connect();
+
+ if (isset($cfg['readPreference'])) {
+ $this->server->setReadPreference($cfg['readPreference']);
+ }
+
if ($this->connection = $this->server->{$cfg['database']}) {
$this->_isConnected = true;
}
Please sign in to comment.
Something went wrong with that request. Please try again.