我有这样的代码:
$users = User::raw(function ($collection) use($profession, $userId, $skip, $pageSize) {
return $collection->aggregate([
[
'$lookup' => [
'from' => 'user_profile',
'localField' => 'uid',
'foreignField' => 'user_id',
'as' => 'profile'
]
],
[
'$match' => [
'profile.field_of_work' => $profession['id'],
'uid' => ['$ne' => $userId]
],
],
['$skip' => $skip],
['$limit' => $pageSize]
]);
});
从那里开始,如何添加如下的where子句:
::where('name', 'like', '%test%');
我不知道如何在mongodb中使用查找,我只知道雄辩的基本模式。 谢谢