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

Function useStreamingProtocol

src/sdam/monitor.ts:245–259  ·  view source on GitHub ↗
(monitor: Monitor, topologyVersion: TopologyVersion | null)

Source from the content-addressed store, hash-verified

243}
244
245function useStreamingProtocol(monitor: Monitor, topologyVersion: TopologyVersion | null): boolean {
246 // If we have no topology version we always poll no matter
247 // what the user provided, since the server does not support
248 // the streaming protocol.
249 if (topologyVersion == null) return false;
250
251 const serverMonitoringMode = monitor.options.serverMonitoringMode;
252 if (serverMonitoringMode === ServerMonitoringMode.poll) return false;
253 if (serverMonitoringMode === ServerMonitoringMode.stream) return true;
254
255 // If we are in auto mode, we need to figure out if we're in a FaaS
256 // environment or not and choose the appropriate mode.
257 if (monitor.isRunningInFaasEnv) return false;
258 return true;
259}
260
261function checkServer(monitor: Monitor, callback: Callback<Document | null>) {
262 let start: number;

Callers 2

checkServerFunction · 0.85
monitorServerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected