MCPcopy
hub / github.com/mongodb/node-mongodb-native / checkHasPrimary

Function checkHasPrimary

src/sdam/topology_description.ts:540–548  ·  view source on GitHub ↗
(serverDescriptions: Map<string, ServerDescription>)

Source from the content-addressed store, hash-verified

538}
539
540function checkHasPrimary(serverDescriptions: Map<string, ServerDescription>): TopologyType {
541 for (const serverDescription of serverDescriptions.values()) {
542 if (serverDescription.type === ServerType.RSPrimary) {
543 return TopologyType.ReplicaSetWithPrimary;
544 }
545 }
546
547 return TopologyType.ReplicaSetNoPrimary;
548}

Callers 3

updateMethod · 0.85
updateRsFromPrimaryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected