Laravel 发送失败";“聚合”;带数据库的命令";“vislog”一词:读取4字节失败:套接字错误或超时
帮助我: 拉维和芒果酒店Laravel 发送失败";“聚合”;带数据库的命令";“vislog”一词:读取4字节失败:套接字错误或超时,laravel,mangodb,Laravel,Mangodb,帮助我: 拉维和芒果酒店 if(!empty($request->ncommercialdata) && $request->ncommercialdata == 'grouped'){ $co = new Commercialgrouped; }else{ $co = new Commercial; } return $co::all(); exit;
if(!empty($request->ncommercialdata) && $request->ncommercialdata == 'grouped'){
$co = new Commercialgrouped;
}else{
$co = new Commercial;
}
return $co::all();
exit;
$spot_per_date = $co::raw(function($collection) use($filter,$variabled,$divider)
{
return $collection->aggregate(array_merge($filter,[
[ '$sort' => [ 'date' => 1 ] ],
[
'$group' => [
'_id' => [
'date'=>'$date',
],
'total' => [
'$sum' => [
'$divide' => [$variabled,$divider]
]
]
]
]
])
,['allowDiskUse' => true]
);
});
$data['spot_per_date'] = [];
foreach($spot_per_date as $key=>$val){
$data['spot_per_date'][$key]['date'] = $val->_id->date;
$data['spot_per_date'][$key]['total'] = $val->total;
if($request->variable == 'COST'){
$data['spot_per_date'][$key]['total'] = number_format($data['spot_per_date'][$key]['total'],2,'.','');
}
}
有错误:
MongoDB\Driver\Exception\ConnectionTimeoutException
无法使用数据库“vislog”发送“聚合”命令:无法读取4字节:套接字错误或超时