File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ class Builder extends BaseBuilder
101101 /**
102102 * The maximum amount of seconds to allow the query to run.
103103 *
104- * @var int
104+ * @var int|float
105105 */
106106 public $ timeout ;
107107
@@ -212,7 +212,7 @@ public function project($columns)
212212 /**
213213 * The maximum amount of seconds to allow the query to run.
214214 *
215- * @param int $seconds
215+ * @param int|float $seconds
216216 *
217217 * @return $this
218218 */
@@ -441,7 +441,7 @@ public function toMql(): array
441441
442442 // Apply order, offset, limit and projection
443443 if ($ this ->timeout ) {
444- $ options ['maxTimeMS ' ] = $ this ->timeout * 1000 ;
444+ $ options ['maxTimeMS ' ] = ( int ) ( $ this ->timeout * 1000 ) ;
445445 }
446446
447447 if ($ this ->orders ) {
Original file line number Diff line number Diff line change @@ -1437,6 +1437,11 @@ function (Builder $elemMatchQuery): void {
14371437 ['find ' => [[], ['hint ' => ['foo ' => 1 ]]]],
14381438 fn (Builder $ builder ) => $ builder ->hint (['foo ' => 1 ]),
14391439 ];
1440+
1441+ yield 'timeout ' => [
1442+ ['find ' => [[], ['maxTimeMS ' => 2346 ]]],
1443+ fn (Builder $ builder ) => $ builder ->timeout (2.3456 ),
1444+ ];
14401445 }
14411446
14421447 #[DataProvider('provideExceptions ' )]
You can’t perform that action at this time.
0 commit comments