laravel 的mongodb 怎么联表筛选?
mongo 中 比如在文章列表中 ,我想筛选小明发布的段子类别的文章列表,这个要怎么写,急,在线等
article : id, title , author_id, category_id
category: id, name
以article为主模型,关联 belong to category
Article::where('author_id', '小明')->whereHas([
'category' => function($query) use ($category_id){
return $query->where('id', $category)
}
])->with();
这样写会报错,怎么办,大大大佬们,help
非关系型数据库这玩意就不适合关联查找
mongodb 用
aggregate