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 @@ -103,7 +103,7 @@ class Builder extends BaseBuilder
103103 /**
104104 * The maximum amount of seconds to allow the query to run.
105105 *
106- * @var int
106+ * @var int|float
107107 */
108108 public $ timeout ;
109109
@@ -214,7 +214,7 @@ public function project($columns)
214214 /**
215215 * The maximum amount of seconds to allow the query to run.
216216 *
217- * @param int $seconds
217+ * @param int|float $seconds
218218 *
219219 * @return $this
220220 */
@@ -457,7 +457,7 @@ public function toMql(): array
457457
458458 // Apply order, offset, limit and projection
459459 if ($ this ->timeout ) {
460- $ options ['maxTimeMS ' ] = $ this ->timeout * 1000 ;
460+ $ options ['maxTimeMS ' ] = ( int ) ( $ this ->timeout * 1000 ) ;
461461 }
462462
463463 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 ' => 2345 ]]],
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