From 759cbdc7c4035ace668a3d6975faa4d03f64c558 Mon Sep 17 00:00:00 2001 From: Neil Smith Date: Mon, 6 Apr 2015 17:50:13 +0100 Subject: [PATCH] Added support for passing driver options to MongoClient Used mainly for configuring SSL details. --- src/Jenssegers/Mongodb/Connection.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Jenssegers/Mongodb/Connection.php b/src/Jenssegers/Mongodb/Connection.php index 52b024de4..526b26704 100644 --- a/src/Jenssegers/Mongodb/Connection.php +++ b/src/Jenssegers/Mongodb/Connection.php @@ -142,7 +142,15 @@ protected function createConnection($dsn, array $config, array $options) $options['password'] = $config['password']; } - return new MongoClient($dsn, $options); + // By default driver options is an empty array. + $driverOptions = array(); + + if (isset($config['driver_options']) && is_array($config['driver_options'])) + { + $driverOptions = $config['driver_options']; + } + + return new MongoClient($dsn, $options, $driverOptions); } /**