MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / reset

Method reset

pymongo/topology_description.py:179–196  ·  view source on GitHub ↗

A copy of this description, with all servers marked Unknown.

(self)

Source from the content-addressed store, hash-verified

177 return updated_topology_description(self, unknown_sd)
178
179 def reset(self) -> TopologyDescription:
180 """A copy of this description, with all servers marked Unknown."""
181 if self._topology_type == TOPOLOGY_TYPE.ReplicaSetWithPrimary:
182 topology_type = TOPOLOGY_TYPE.ReplicaSetNoPrimary
183 else:
184 topology_type = self._topology_type
185
186 # The default ServerDescription's type is Unknown.
187 sds = {address: ServerDescription(address) for address in self._server_descriptions}
188
189 return TopologyDescription(
190 topology_type,
191 sds,
192 self._replica_set_name,
193 self._max_set_version,
194 self._max_election_id,
195 self._topology_settings,
196 )
197
198 def server_descriptions(self) -> dict[_Address, ServerDescription]:
199 """dict of (address,

Callers

nothing calls this directly

Calls 2

ServerDescriptionClass · 0.90
TopologyDescriptionClass · 0.85

Tested by

no test coverage detected