File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ Retryable writes: actionable error message when using retryable writes on unsupported storage engines
3+ --SKIPIF--
4+ <?php require __DIR__ . "/../utils/basic-skipif.inc " ; ?>
5+ <?php skip_if_not_libmongoc_crypto (); ?>
6+ <?php skip_if_not_server_storage_engine ('mmapv1 ' ); ?>
7+ <?php skip_if_not_replica_set (); ?>
8+ <?php skip_if_server_version ('< ' , '3.6 ' ); ?>
9+ <?php skip_if_not_clean (); ?>
10+ --FILE--
11+ <?php
12+ require_once __DIR__ . "/../utils/basic.inc " ;
13+
14+ $ manager = new MongoDB \Driver \Manager (URI , ['retryWrites ' => true ]);
15+ $ session = $ manager ->startSession ();
16+
17+ echo throws (
18+ function () use ($ manager , $ session ) {
19+ $ command = new MongoDB \Driver \Command ([
20+ 'findAndModify ' => COLLECTION_NAME ,
21+ 'query ' => ['x ' => 1 ],
22+ 'update ' => ['$inc ' => ['x ' => 1 ]],
23+ ]);
24+ $ manager ->executeReadWriteCommand (DATABASE_NAME , $ command , ['session ' => $ session ]);
25+ },
26+ \MongoDB \Driver \Exception \CommandException::class
27+ );
28+ echo "\n" ;
29+
30+ ?>
31+ ===DONE===
32+ <?php exit (0 ); ?>
33+ --EXPECT--
34+ OK: Got MongoDB\Driver\Exception\CommandException
35+ This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string.
36+ ===DONE===
You can’t perform that action at this time.
0 commit comments