public static function config($config = array()) { if (self::$config === null) { self::$config = $config; } return self::$config; }
public function action_mongo() { MDB::$config = Kohana::$config->load('database')->mongo; $config = MDB::config(); #d::v($config); $mongo = MDB::mongo(); d::v($mongo); $db = MDB::db(); d::cl($db); $colle = MDB::collection('test'); d::cl($colle); $data = array('data' => 'test'); $insert = MDB::insert($data); d::v($insert); $find = MDB::find(); d::cl($find); d::v(iterator_to_array($find)); $gridFS = MDB::gridFS(); d::cl($gridFS); $remove = MDB::remove(); d::v($remove); }
protected function __construct() { MDB::$config = Kohana::$config->load('database')->mongo; $this->collection = MDB::collection($this->collection); }