php - How to find a sub array in cakephp with mongodb -


i have problem mongodb using cakephp. don't know how find record sub-array.

i have structure in mongodb

id:"xxx", profile:[ {     profile_pic:"xxx",     firstname:"xxx",     lastname:"xxx",     slug:"xxx" } 

]

i pass on slug variable in controller , want corresponding record slug. use code:

$profile = $this->user->find('first', array('first', array('conditions' => array('user.profile.slug' => $this->request['slug'])))); 

but code not working.

aiyoh,

i had wrong query in profile. should be:

$profile = $this->user->find('first', array('conditions' => array('profile.slug' => $this->request['slug']))); 

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -