File tree Expand file tree Collapse file tree 3 files changed +95
-0
lines changed
Expand file tree Collapse file tree 3 files changed +95
-0
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ MongoDB\Driver\BulkWrite::delete() collation option requires MongoDB 3.4
3+ --SKIPIF--
4+ <?php require __DIR__ . "/../utils/basic-skipif.inc " ; ?>
5+ <?php skip_if_not_live (); ?>
6+ <?php skip_if_server_version ('>= ' , '3.4 ' ); ?>
7+ --FILE--
8+ <?php
9+ require_once __DIR__ . "/../utils/basic.inc " ;
10+
11+ $ manager = new MongoDB \Driver \Manager (URI );
12+
13+ $ bulk = new MongoDB \Driver \BulkWrite ();
14+
15+ $ bulk ->delete (
16+ ['name ' => 'foo ' ],
17+ ['collation ' => ['locale ' => 'en_US ' ]]
18+ );
19+
20+ echo throws (function () use ($ manager , $ bulk ) {
21+ $ manager ->executeBulkWrite (DATABASE_NAME . '. ' . COLLECTION_NAME , $ bulk );
22+ }, 'MongoDB\Driver\Exception\RuntimeException ' ), "\n" ;
23+
24+ ?>
25+ ===DONE===
26+ <?php exit (0 ); ?>
27+ --EXPECT--
28+ OK: Got MongoDB\Driver\Exception\RuntimeException
29+ The selected server does not support collation
30+ ===DONE===
Original file line number Diff line number Diff line change 1+ --TEST--
2+ MongoDB\Driver\BulkWrite::update() collation option requires MongoDB 3.4
3+ --SKIPIF--
4+ <?php require __DIR__ . "/../utils/basic-skipif.inc " ; ?>
5+ <?php skip_if_not_live (); ?>
6+ <?php skip_if_server_version ('>= ' , '3.4 ' ); ?>
7+ --FILE--
8+ <?php
9+ require_once __DIR__ . "/../utils/basic.inc " ;
10+
11+ $ manager = new MongoDB \Driver \Manager (URI );
12+
13+ $ bulk = new MongoDB \Driver \BulkWrite ();
14+
15+ $ bulk ->update (
16+ ['name ' => 'foo ' ],
17+ ['$inc ' => ['size ' => 1 ]],
18+ ['collation ' => ['locale ' => 'en_US ' ]]
19+ );
20+
21+ echo throws (function () use ($ manager , $ bulk ) {
22+ $ manager ->executeBulkWrite (DATABASE_NAME . '. ' . COLLECTION_NAME , $ bulk );
23+ }, 'MongoDB\Driver\Exception\RuntimeException ' ), "\n" ;
24+
25+ ?>
26+ ===DONE===
27+ <?php exit (0 ); ?>
28+ --EXPECT--
29+ OK: Got MongoDB\Driver\Exception\RuntimeException
30+ The selected server does not support collation
31+ ===DONE===
Original file line number Diff line number Diff line change 1+ --TEST--
2+ MongoDB\Driver\BulkWrite::update() arrayFilters option requires MongoDB 3.6
3+ --SKIPIF--
4+ <?php require __DIR__ . "/../utils/basic-skipif.inc " ; ?>
5+ <?php skip_if_not_live (); ?>
6+ <?php skip_if_server_version ('>= ' , '3.6 ' ); ?>
7+ --FILE--
8+ <?php
9+ require_once __DIR__ . "/../utils/basic.inc " ;
10+
11+ $ manager = new MongoDB \Driver \Manager (URI );
12+
13+ $ bulk = new MongoDB \Driver \BulkWrite ();
14+
15+ $ bulk ->update (
16+ ['grades ' => ['$gte ' => 100 ]],
17+ ['$set ' => ['grades.$[element] ' => 100 ]],
18+ [
19+ 'arrayFilters ' => [['element ' => ['$gte ' => 100 ]]],
20+ 'multi ' => true ,
21+ ]
22+ );
23+
24+ echo throws (function () use ($ manager , $ bulk ) {
25+ $ manager ->executeBulkWrite (DATABASE_NAME . '. ' . COLLECTION_NAME , $ bulk );
26+ }, 'MongoDB\Driver\Exception\RuntimeException ' ), "\n" ;
27+
28+ ?>
29+ ===DONE===
30+ <?php exit (0 ); ?>
31+ --EXPECT--
32+ OK: Got MongoDB\Driver\Exception\RuntimeException
33+ The selected server does not support array filters
34+ ===DONE===
You can’t perform that action at this time.
0 commit comments