Constructor.
List of available options:
\Mongo|\MongoClient $mongo A MongoClient or Mongo instance:
array $options An associative array of field options:
\InvalidArgumentException When MongoClient or Mongo instance not provided
\InvalidArgumentException When "database" or "collection" not provided
public function __construct($mongo, array $options) {
if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo)) {
throw new \InvalidArgumentException('MongoClient or Mongo instance required');
}
if (!isset($options['database']) || !isset($options['collection'])) {
throw new \InvalidArgumentException('You must provide the "database" and "collection" option for MongoDBSessionHandler');
}
$this->mongo = $mongo;
$this->options = array_merge(array(
'id_field' => '_id',
'data_field' => 'data',
'time_field' => 'time',
), $options);
}