$whisper =new MongoDB\Client(Config::get('mongodb.whisper_conn')); 连接数据库
$whisper = $whisper->selectDatabase(config::get("mongodb.whisper_name")); 选择库名
$collection = $whisper->selectCollection('message'); 选择表名
#####
find条件查询
$collection->count(); <==> mysql:: select count() from table
$collection->find(); <==> mysql:: select from table
$collection->findOne(); <==> select * from table limit 1
select rid,xid from table where _id = xxxxxxxxx
$id = new \MongoDB\BSON\ObjectId('5922babf421aa96b507ee41b');
$fileter = ['_id'=> $id ] $options = ['rid'=>1,'xid'=>1];
$collection->find($fileter,$options)
select * from table limit 10
$fileter = [] $options = ['limit'=>10];
$collection->find($fileter,$options)
select * from table limit 10,10 分页读
$fileter = [] $options = ['skip'=>10,limit'=>10];
$collection->find($fileter,$options)
select * from table limit 10,10 分页读
$fileter = [] $options = ['skip'=>10,limit'=>10];
$collection->find($fileter,$options)
betweeen 范围时间查询 select * from table where tt>=$start && tt<$end
$start = new MongoDB\BSON\UTCDateTime(strtotime('2018-11-01 00:00:00')* 1000);
$end = new MongoDB\BSON\UTCDateTime(time()* 1000);
$fileter = [‘time’=>['$gte'=>$start,'$lt'=>$end] $options = ['skip'=>10,limit'=>10];
$collection->find($fileter,$options)