我的數據庫中有大約60k的文檔,我無法查詢它們。我能夠成功檢索它們的唯一方法是使用水合物(假)選項。基本教條MongoDB拋出的內存不足異常
我曾經嘗試都:
$dm = $this->get('doctrine_mongodb')->getManager();
$qb = $dm->createQueryBuilder('BConwayWebsiteBundle:Business')
->eagerCursor(true);
$query = $qb->getQuery();
$results = $query->execute();
和
$dm = $this->get('doctrine_mongodb')->getManager();
$qb = $dm->createQueryBuilder('BConwayWebsiteBundle:Business');
$query = $qb->getQuery();
$results = $query->execute();
如果我傾倒$結果>將IsInitialized()它是假的。我相信那是因爲在那時我還沒有使用它。儘管我試圖做的任何訪問都會導致內存問題。甚至像$ results-> count()一樣基本。
[2013-10-01 23:54:55] doctrine.INFO: MongoDB query: {"find":true,"query":[],"fields":[],"db":"ClosedForTheHoliday","collection":"businesses"} [] []
[2013-10-01 23:54:55] doctrine.INFO: MongoDB query: {"limit":true,"limitNum":null,"query":[],"fields":[]} [] []
[2013-10-01 23:54:55] doctrine.INFO: MongoDB query: {"skip":true,"skipNum":null,"query":[],"fields":[]} [] []
[2013-10-01 23:54:55] doctrine.INFO: MongoDB query: {"sort":true,"sortFields":[],"query":[],"fields":[]} [] []
[2013-10-01 23:54:56] emergency.EMERGENCY: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) {"type":1,"file":"/media/sf_sites/cfth_com/vendor/doctrine/mongodb/lib/Doctrine/MongoDB/Cursor.php","line":237} []
更新:如果我限制我的結果到2000年,它的工作原理。此外,如果我在查詢後只選擇兩個字段,我可以將其限制爲15000並取得成功。當我將其限制爲2000時,dev調試欄顯示查詢使用了120MB的內存。我需要能夠遍歷所有結果,並且不能分頁。這似乎應該是可能的,而不必100MB +查詢...