vibe.db.mongo.topology
MongoDB topology description and server selection.
Implements server selection logic for replica sets based on the MongoDB Server Selection specification.
See Also
Copyright
© 2026 GISCollective
License
Subject to the terms of the MIT license, as written in the included LICENSE.txt file.
Types 3
enumTopologyType
Tracks the known state of all servers in a deployment.
Updated after each successful handshake. Used by server selection to pick an appropriate host for a given read preference.
unknown
single
replicaSetWithPrimary
replicaSetNoPrimary
sharded
structTopologyDescription
Fields
ServerRecord[] serversstring setNameTopologyType typeuint seedCountNullable!BsonObjectID maxElectionIdNullable!int maxSetVersionMethods
void update(MongoHost host, ServerDescription desc)void markFailed(MongoHost host)MongoHost[] allKnownHosts() constNullable!MongoHost randomMongosHost(long localThresholdMS = 15) constNullable!MongoHost primaryHost() constNullable!MongoHost randomSecondaryHost(long maxStalenessSeconds = - 1) constMongoHost[] secondaryHosts(long maxStalenessSeconds = - 1) constNullable!MongoHost randomHostWithinLatencyWindow(long localThresholdMS, long maxStalenessSeconds = - 1) conststructServerRecord
Functions 1
fn
Nullable!MongoHost selectServer(ref const TopologyDescription topology, ReadPreference pref,
long localThresholdMS = 15, long maxStalenessSeconds = - 1) @safeSelects a server from the topology based on the given read preference.