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
103
103
/**
104
104
* The maximum amount of seconds to allow the query to run.
105
105
*
106
- * @var int
106
+ * @var int|float
107
107
*/
108
108
public $ timeout ;
109
109
@@ -214,7 +214,7 @@ public function project($columns)
214
214
/**
215
215
* The maximum amount of seconds to allow the query to run.
216
216
*
217
- * @param int $seconds
217
+ * @param int|float $seconds
218
218
*
219
219
* @return $this
220
220
*/
@@ -457,7 +457,7 @@ public function toMql(): array
457
457
458
458
// Apply order, offset, limit and projection
459
459
if ($ this ->timeout ) {
460
- $ options ['maxTimeMS ' ] = $ this ->timeout * 1000 ;
460
+ $ options ['maxTimeMS ' ] = ( int ) ( $ this ->timeout * 1000 ) ;
461
461
}
462
462
463
463
if ($ this ->orders ) {
Original file line number Diff line number Diff line change @@ -1437,6 +1437,11 @@ function (Builder $elemMatchQuery): void {
1437
1437
['find ' => [[], ['hint ' => ['foo ' => 1 ]]]],
1438
1438
fn (Builder $ builder ) => $ builder ->hint (['foo ' => 1 ]),
1439
1439
];
1440
+
1441
+ yield 'timeout ' => [
1442
+ ['find ' => [[], ['maxTimeMS ' => 2345 ]]],
1443
+ fn (Builder $ builder ) => $ builder ->timeout (2.3456 ),
1444
+ ];
1440
1445
}
1441
1446
1442
1447
#[DataProvider('provideExceptions ' )]
You can’t perform that action at this time.
0 commit comments