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

Function writableServerSelector

src/sdam/server_selection.ts:52–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50 * Returns a server selector that selects for writable servers
51 */
52export function writableServerSelector(): ServerSelector {
53 return function writableServer(
54 topologyDescription: TopologyDescription,
55 servers: ServerDescription[],
56 deprioritized: DeprioritizedServers
57 ): ServerDescription[] {
58 const eligibleServers = filterDeprioritized(
59 servers.filter(({ isWritable }) => isWritable),
60 deprioritized
61 );
62
63 return latencyWindowReducer(topologyDescription, eligibleServers);
64 };
65}
66
67/**
68 * The purpose of this selector is to select the same server, only

Callers 2

Calls 3

filterDeprioritizedFunction · 0.85
latencyWindowReducerFunction · 0.85
filterMethod · 0.45

Tested by

no test coverage detected