protected function _init() {
parent::_init();
$this->_operators += array(
'like' => function($key, $value) { return new MongoRegex($value); }
);
$this->_handlers += array(
'id' => function($v) {
return is_string($v) && preg_match('/^[0-9a-f]{24}$/', $v) ? new MongoId($v) : $v;
},
'date' => function($v) {
$v = is_numeric($v) ? intval($v) : strtotime($v);
return (!$v || time() == $v) ? new MongoDate() : new MongoDate($v);
},
'regex' => function($v) { return new MongoRegex($v); },
'integer' => function($v) { return (integer) $v; },
'float' => function($v) { return (float) $v; },
'boolean' => function($v) { return (boolean) $v; },
'code' => function($v) { return new MongoCode($v); },
'binary' => function($v) { return new MongoBinData($v); }
);
}