관리-도구
편집 파일: server-executeCommand-007.phpt
--TEST-- MongoDB\Driver\Server::executeCommand() sends read preference to mongos --SKIPIF-- <?php require __DIR__ . "/../utils/basic-skipif.inc"; ?> <?php skip_if_not_mongos(); ?> --FILE-- <?php require_once __DIR__ . "/../utils/basic.inc"; require_once __DIR__ . "/../utils/observer.php"; $manager = create_test_manager(); $server = $manager->selectServer(new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::PRIMARY)); (new CommandObserver)->observe( function() use ($server) { $server->executeCommand( DATABASE_NAME, new MongoDB\Driver\Command(['ping' => true]), [ 'readPreference' => new \MongoDB\Driver\ReadPreference(\MongoDB\Driver\ReadPreference::NEAREST), ] ); }, function(stdClass $command) { echo "Read Preference: ", $command->{'$readPreference'}->mode, "\n"; } ); ?> ===DONE=== <?php exit(0); ?> --EXPECTF-- Read Preference: nearest ===DONE===