File tree 2 files changed +8
-3
lines changed
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
101
101
/**
102
102
* The maximum amount of seconds to allow the query to run.
103
103
*
104
- * @var int
104
+ * @var int|float
105
105
*/
106
106
public $ timeout ;
107
107
@@ -212,7 +212,7 @@ public function project($columns)
212
212
/**
213
213
* The maximum amount of seconds to allow the query to run.
214
214
*
215
- * @param int $seconds
215
+ * @param int|float $seconds
216
216
*
217
217
* @return $this
218
218
*/
@@ -441,7 +441,7 @@ public function toMql(): array
441
441
442
442
// Apply order, offset, limit and projection
443
443
if ($ this ->timeout ) {
444
- $ options ['maxTimeMS ' ] = $ this ->timeout * 1000 ;
444
+ $ options ['maxTimeMS ' ] = ( int ) ( $ this ->timeout * 1000 ) ;
445
445
}
446
446
447
447
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 ' => 2346 ]]],
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