-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
ALL
Hi
yii::$app->mongodb->GetCollection('sessions')->Aggregate([ [ '$lookup' => [ 'from' => 'users', 'localField' => '_userId', 'foreignField' => '_id', 'let' => ['sRoleId' => '$_roleId'], 'pipeline' => [ [ '$match' => [ 'enable' => true, ], ], [ '$lookup' => [ 'from' => 'roles', 'pipeline' => [ [ '$match' => [ //'$expr' => ['$_id' => '$$sRoleId'], //Error //'$expr' => ['x' => 'y'], //Always is true and return all docs '$expr' => ['$eq' => ['$_id','$$sRoleId']], //OK ], ], ], 'as' => 'role', ], ], ], 'as' => 'user', ], ], ]);