【发布时间】:2021-05-09 12:37:12
【问题描述】:
需要将$contents 作为boundaries 值传递,但我面临上述错误。请帮忙。提前致谢
$contents = $query->pluck('competition_id')->toArray();
$data = $query->raw(function ($collection) {
return $collection->aggregate([
[
'$bucket' => [
'groupBy' => '$competition_id',
'boundaries' => '$contents',
'default' => "Other",
'output' => [
"data" => [
'$push' => [
"id" => '$id',
"season_id" => '$season_id',
"status_id" => '$status_id',
"venue_id" => '$venue_id',
"referee_id" => '$referee_id',
"neutral" => '$neutral',
]
]
]
]
]
]);
});
【问题讨论】:
标签: laravel mongodb aggregation-framework