Skip to content

Commit 59da592

Browse files
committed
Merge pull request #444
2 parents b388634 + b7dbc99 commit 59da592

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

src/MongoDB/Query.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@ static bool php_phongo_query_init(php_phongo_query_t *intern, zval *filter, zval
252252
}
253253
}
254254

255-
PHONGO_QUERY_OPT_BOOL("allowPartialResults", options, "allowPartialResults");
255+
PHONGO_QUERY_OPT_BOOL("allowPartialResults", options, "allowPartialResults")
256+
else PHONGO_QUERY_OPT_BOOL("allowPartialResults", options, "partial");
256257
PHONGO_QUERY_OPT_BOOL("awaitData", options, "awaitData");
257258
PHONGO_QUERY_OPT_INT64("batchSize", options, "batchSize");
258259
PHONGO_QUERY_OPT_DOCUMENT("collation", options, "collation");

tests/query/query-ctor-006.phpt

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
===DONE===
21+
<?php exit(0); ?>
22+
--EXPECTF--
23+
object(MongoDB\Driver\Query)#%d (%d) {
24+
["filter"]=>
25+
object(stdClass)#%d (%d) {
26+
["x"]=>
27+
int(1)
28+
}
29+
["options"]=>
30+
object(stdClass)#%d (%d) {
31+
["allowPartialResults"]=>
32+
bool(true)
33+
}
34+
["readConcern"]=>
35+
NULL
36+
}
37+
object(MongoDB\Driver\Query)#%d (%d) {
38+
["filter"]=>
39+
object(stdClass)#%d (%d) {
40+
["x"]=>
41+
int(1)
42+
}
43+
["options"]=>
44+
object(stdClass)#%d (%d) {
45+
["allowPartialResults"]=>
46+
bool(false)
47+
}
48+
["readConcern"]=>
49+
NULL
50+
}
51+
===DONE===

0 commit comments

Comments
 (0)