function __construct($prefix) { if (!isset(self::$_mongodb)) { $server = defined('MONGODB_SERVER_CONFIG') ? MONGODB_SERVER_CONFIG : "mongodb://localhost:27017"; $option = defined('MONGODB_OPTION_CONFIG') ? eval(MONGODB_OPTION_CONFIG) : array("connect" => TRUE); $m = new MongoClient($server, $option); $db = $m->vmcshop_kvstore; self::$_mongodb = $db->selectCollection(base_kvstore::kvprefix()); } $this->prefix = $prefix; }
function __construct($prefix) { if (!isset(self::$_mongodb)) { $hosts = (array) config::get('kvstore.base_kvstore_mongodb.hosts', 'mongodb://localhost:27017'); $options = config::get('kvstore.base_kvstore_mongodb.options', array("connect" => TRUE)); $hosts = implode(',', $hosts); $m = new MongoClient($hosts, $options); $db = $m->ecos; //todo 需要改成config配置 self::$_mongodb = $db->selectCollection(base_kvstore::kvprefix()); } $this->prefix = $prefix; }
function __construct($prefix) { if (!isset(self::$_mongodb)) { $server = defined('MONGODB_SERVER_CONFIG') ? MONGODB_SERVER_CONFIG : "mongodb://localhost:27017"; $option = defined('MONGODB_OPTION_CONFIG') ? eval(MONGODB_OPEION_CONFIG) : array("connect" => TRUE); $m = new Mongo($server, $option); // var_dump($m);exit; $db = $m->ecos; //todo 需要改成config配置 self::$_mongodb = $db->selectCollection(base_kvstore::kvprefix()); } $this->prefix = $prefix; }
function __construct($prefix) { if (!isset(self::$_mongodb)) { $server = defined('MONGODB_SERVER_CONFIG') ? MONGODB_SERVER_CONFIG : "mongodb://localhost:27017"; $option = defined('MONGODB_OPTION_CONFIG') ? eval(MONGODB_OPEION_CONFIG) : array("connect" => TRUE); $m = new Mongo($server, $option); // Andrew 20121023 // 更改collection名称 $db = $m->tnf_store; //todo 需要改成config配置 self::$_mongodb = $db->selectCollection(base_kvstore::kvprefix()); // Andrew 20121120 self::$_mongodb->ensureIndex(array('key' => 1)); } $this->prefix = $prefix; }