Dealing With 2 Related Emongodocument ( Yiimongodbsuite )

I have 2 Models in in application advertisement and user. None of them is EMongoEmbeddedDocument.They look like this.

class advertisement extends EMongoDocument



$adv_user /*This is another EMongoDocument */

public function embeddedDocuments()

{ return array('adv_user' => 'user',);}


class User extends EMongoDocument

{ $username }

Following are the problems I am facing.

  1. If I have user objectid after creating user. How can I link this user to any advertisment.

Didnt work

  1. How to access primary object id of user from advertisement table in criteria

$Criteria=new EMongoCriteria();


doesn’t work

I am new