Reputation: 347
I have 2 classes which extends\yii\mongodb\ActiveRecord
for example Users
and Posts
relations between this classes User have many posts.
Upvotes: 2
Views: 1510
Reputation: 8072
The same way as using relational databases:
public function getPosts()
{
return $this->hasMany(Posts::className(),['_id'=>'user_id']);
}
Upvotes: 1