|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests |
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 14:00:01 2025 UTC |
Description: ------------ Contrary as what the documentation says, MongoCursor::maxTimeMS() doesn't always throws MongoExecutionTimeoutException, it doesn't work this way when you use next() on the cursor. See the working script examples for details! Test script: --------------- // Currently throwing exception (fine!) // Any slightly big collection should do here $cursor = $mongo->test->test->find(['i' => 9999999])->maxTimeMS(1); // $doc = iterator_to_array($cursor); foreach ($cursor as $item) { var_dump($item); } // Doesn't throw an exception (bad!) $doc = $mongo->test->test->find(['i' => 9999999])->maxTimeMS(1)->next(); var_dump($doc); // Will display: // array(2) { // '$err' => // string(29) "operation exceeded time limit" // 'code' => // int(50) // }