Z
Z
zvuki2011-12-02 17:26:03
symfony
zvuki, 2011-12-02 17:26:03

[SOLVED] How to query with $or in Doctrine MongoDB ODM?

How to do it in mongo: www.mongodb.org/display/DOCS/Advanced+Queries#Adva...
I guess it can't be done (there's nothing in the docs and API). What then to do if such requests are needed? Any ideas are welcome :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zvuki, 2011-12-02
@zvuki

found)
/**
* Adds an "or" expression to the current query.
*
* You can create the expression using the expr() method:
*
* $qb = $this->createQueryBuilder('User');
* $qb
* ->addOr($qb->expr()->field('first_name')->equals('Kris'))
* ->addOr($qb->expr()->field('first_name')->equals('Chris'));
*
*/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question