Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit 896606a

Browse files
committed
HHVM-259: Query "partial" option is now "allowPartialResults"
1 parent ef477bc commit 896606a

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

ext_mongodb.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,8 @@ public function __construct(mixed $filter, array $options = array())
711711
}
712712
}
713713

714-
$this->_queryOptBool( 'allowPartialResults', $options, 'allowPartialResults' );
714+
$this->_queryOptBool( 'allowPartialResults', $options, 'allowPartialResults' )
715+
|| $this->_queryOptBool( 'allowPartialResults', $options, 'partial' );
715716
$this->_queryOptBool( 'awaitData', $options, 'awaitData' );
716717
$this->_queryOptInt64( 'batchSize', $options, 'batchSize' );
717718
$this->_queryOptDocument( 'collation', $options, 'collation' );
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
--TEST--
2+
MongoDB\Driver\Query construction "allowPartialResults" overrides "partial" option
3+
--FILE--
4+
<?php
5+
6+
var_dump(new MongoDB\Driver\Query(
7+
['x' => 1],
8+
['partial' => true]
9+
));
10+
11+
var_dump(new MongoDB\Driver\Query(
12+
['x' => 1],
13+
[
14+
'allowPartialResults' => false,
15+
'partial' => true,
16+
]
17+
));
18+
19+
?>
20+
--EXPECTF--
21+
object(MongoDB\Driver\Query)#%d (%d) {
22+
["filter"]=>
23+
object(stdClass)#%d (%d) {
24+
["x"]=>
25+
int(1)
26+
}
27+
["options"]=>
28+
object(stdClass)#%d (%d) {
29+
["allowPartialResults"]=>
30+
bool(true)
31+
}
32+
["readConcern"]=>
33+
NULL
34+
}
35+
object(MongoDB\Driver\Query)#%d (%d) {
36+
["filter"]=>
37+
object(stdClass)#%d (%d) {
38+
["x"]=>
39+
int(1)
40+
}
41+
["options"]=>
42+
object(stdClass)#%d (%d) {
43+
["allowPartialResults"]=>
44+
bool(false)
45+
}
46+
["readConcern"]=>
47+
NULL
48+
}

0 commit comments

Comments
 (0)