john Smith john Smith - 1 year ago 69
PHP Question

Doctrine2 ODM Limit dont work / mongodb

i´m trying to skip and limit results but i dont even get it to work to limit results.

heres my code

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


and the var_dump returns


and thats equal to all entities in database, what am i dooing wrong ?


is instance of


and the builder is instance of


i just dont understand whats 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