Reputation: 395
How do I set timeout to no limit on Doctrine2 for MongoDb used in Symfony2.3? Tried to set the limit and the query after 30 seconds timesout but the 'raw' query works fine on Mongodb CLI which takes about 90 seconds (or more) to complete.
$qb = $this->createQueryBuilder('BaseLog')
->hydrate(true)
->field('template_id')->Equals($templateId);
...
return $qb->getQuery(array('timeout' => -1))->execute();
Upvotes: 2
Views: 4767
Reputation: 39390
Seems the timeout of the MongoDB cursor Object (a timeout can be changed as described here).
With the DoctrineMongoDBBundle you can modify the timeout
configuration key, as described here. Change the config.yml as example, as follow:
# app/config/config.yml
doctrine_mongodb:
connections:
default:
server: mongodb://localhost:27017
options:
timeout: 240 # <-- increase the default timeout
default_database: hello_%kernel.environment%
document_managers:
default:
mappings:
AcmeDemoBundle: ~
filters:
filter-name:
class: Class\Example\Filter\ODM\ExampleFilter
enabled: true
metadata_cache_driver: array # array, apc, xcache, memcache
Hope this help
Upvotes: 1