MongoDB数据库链接
目前网上大多数的数据库操作还是应用的mongo 的php拓展,其通过new Mongo() [弃用]链接mongo 但是php7 以后是默认mongodb 这个拓展 ;
链接示例:
$con = new \MongoDB\Client("mongodb://username:password@host:port/",[
'database'=>'easyeda', // sets the authentication database required by mongo 3
'ssl' => false,
'replicaSet' => 're-babala',//分布式
'connectTimeoutMS' => 300000
]);
//选择库
$db = $con->selectDatabase('easyeda');
//选择集合
$collection = $db->selectCollection('easyeda_order');