Skip to content

Commit faba869

Browse files
committed
Merge pull request #460 from NSmithUK/AddMongoClientDriverOptions
Added support for passing driver options to MongoClient (SSL support)
2 parents 268c3be + 759cbdc commit faba869

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Jenssegers/Mongodb/Connection.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,15 @@ protected function createConnection($dsn, array $config, array $options)
142142
$options['password'] = $config['password'];
143143
}
144144

145-
return new MongoClient($dsn, $options);
145+
// By default driver options is an empty array.
146+
$driverOptions = array();
147+
148+
if (isset($config['driver_options']) && is_array($config['driver_options']))
149+
{
150+
$driverOptions = $config['driver_options'];
151+
}
152+
153+
return new MongoClient($dsn, $options, $driverOptions);
146154
}
147155

148156
/**

0 commit comments

Comments
 (0)