1

i want to get an array object of documents where an array fiel contains a specific value. My collection is something like :

{
 "name" : "name",
 "groups" : ["id1","id2"]
}

Using doctrine_mongodb and repository, i want for example all the documents where groups field contains value id2.

2
  • Have you tried anything?
    – malarzm
    Jan 8, 2018 at 20:44
  • Actually, i did and $this->get('doctrine_mongodb')->getManager()->getRepository('AppBundle:class')->findBy(array('groups' => [$id1])); worked fine.
    – mockingbid
    Jan 8, 2018 at 21:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.