john Smith john Smith - 1 year ago 129
PHP Question

Doctrine2 ODM Limit doesn't work / mongodb

I'm trying to skip and limit results, but I don't even get it to limit the results.

here's my code

$fooQueryBuilder = $this->mongo->getManager()->createQueryBuilder('CustomCoreBundle:Foo');


and the var_dump returns


and that's equal to all entities in the database, what am I doing wrong ?


is instance of


and the builder is instance of


I just don't understand what's wrong, thanks for any hint

Answer Source

so i found out the answer myself

it is working !

and i learned:

when you count() a cursor, no matter what query, it returns the amount of all entities in database.

so my check to count the cursor to see if the limit is working was simply wrong

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download