2015-04-05 78 views
0

例如,我有this MongoDBYii2 MongoDB的查詢選擇查詢

在yii2,我想編寫一個查詢找到一個email = 'abc'。我有這個代碼:

$query->select([])->from('Post')->where(['Comments.Email' => 'abc']); 

但它不起作用;請幫助我,因爲我是Yii2和MongoDB的初學者。

回答

2

你可以試試這個

Document::find()->where(["comments"=>["document"=>["email"=>"abc"]]])->all();