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\ServerDescription::getTypeMongoDB\Driver\TopologyDescription::getServers>
^MongoDB\DriverLast updated: Mon, 26 Oct 2026

The MongoDB\Driver\TopologyDescription class

(mongodb >=1.13.0)

Introduction

The MongoDB\Driver\TopologyDescription class is a value object that represents a topology to which the driver is connected. Instances of this class are returned by MongoDB\Driver\Monitoring\TopologyChangedEvent methods.

Class synopsis

final class MongoDB\Driver\TopologyDescription {
/* Constants */
const string TYPE_UNKNOWN = "Unknown";
const string TYPE_SINGLE = "Single";
const string TYPE_SHARDED = "Sharded";
const string TYPE_REPLICA_SET_NO_PRIMARY = "ReplicaSetNoPrimary";
const string TYPE_REPLICA_SET_WITH_PRIMARY = "ReplicaSetWithPrimary";
const string TYPE_LOAD_BALANCED = "LoadBalanced";
/* Methods */
final public function getServers(): array
final public function getType(): string
final public function hasReadableServer(?MongoDB\Driver\ReadPreference $readPreference = null): bool
final public function hasWritableServer(): bool
}

Table of Contents


<MongoDB\Driver\ServerDescription::getTypeMongoDB\Driver\TopologyDescription::getServers>
^MongoDB\DriverLast updated: Mon, 26 Oct 2026