Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<MongoDB\Driver\Monitoring\CommandSucceededEvent::getServiceIdMongoDB\Driver\Monitoring\ServerChangedEvent::getHost>
^MongoDB\Driver\MonitoringLast updated: Mon, 26 Oct 2026

The MongoDB\Driver\Monitoring\ServerChangedEvent class

(mongodb >=1.13.0)

Introduction

The MongoDB\Driver\Monitoring\ServerChangedEvent class encapsulates information about a changed server description. For example, a server's type changing from secondary to primary would cause its server description to change.

Class synopsis

final class MongoDB\Driver\Monitoring\ServerChangedEvent {
/* Properties */
public readonly string $host;
public readonly int $port;
/* Methods */
final public function getHost(): string
final public function getPort(): int
final public function getTopologyId(): MongoDB\BSON\ObjectId
}

Properties

host

The hostname of the server.

port

The port of the server.

topologyId

The topology ID.

newDescription

The new server description.

previousDescription

The previous server description.

Changelog

Version Description
PECL mongodb 2.3.0 Added public readonly properties.

Table of Contents


<MongoDB\Driver\Monitoring\CommandSucceededEvent::getServiceIdMongoDB\Driver\Monitoring\ServerChangedEvent::getHost>
^MongoDB\Driver\MonitoringLast updated: Mon, 26 Oct 2026