deno.land / x / mongoose@6.7.5 / lib / helpers / topology / isAtlas.js

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'use strict';
const getConstructorName = require('../getConstructorName');
/** * @typedef { import('mongodb').TopologyDescription } TopologyDescription */
/** * Checks if topologyDescription contains servers connected to an atlas instance * * @param {TopologyDescription} topologyDescription * @returns {boolean} */module.exports = function isAtlas(topologyDescription) { if (getConstructorName(topologyDescription) !== 'TopologyDescription') { return false; }
if (topologyDescription.servers.size === 0) { return false; }
for (const server of topologyDescription.servers.values()) { if (server.host.endsWith('.mongodb.net') === false || server.port !== 27017) { return false; } }
return true;};
mongoose

Version Info

Tagged at
a year ago