This commit is contained in:
Jonasz Bigda
2023-03-25 21:51:42 +01:00
parent 0db1d5117e
commit b332e9ceb0
1044 changed files with 37502 additions and 63938 deletions

View File

@@ -1,11 +1,12 @@
'use strict';
const getConstructorName = require('../getConstructorName');
module.exports = function allServersUnknown(topologyDescription) {
if (topologyDescription == null ||
topologyDescription.constructor.name !== 'TopologyDescription') {
if (getConstructorName(topologyDescription) !== 'TopologyDescription') {
return false;
}
return Array.from(topologyDescription.servers.values()).
every(server => server.type === 'Unknown');
const servers = Array.from(topologyDescription.servers.values());
return servers.length > 0 && servers.every(server => server.type === 'Unknown');
};

View File

@@ -1,11 +1,13 @@
'use strict';
const getConstructorName = require('../getConstructorName');
module.exports = function isAtlas(topologyDescription) {
if (topologyDescription == null ||
topologyDescription.constructor.name !== 'TopologyDescription') {
if (getConstructorName(topologyDescription) !== 'TopologyDescription') {
return false;
}
return Array.from(topologyDescription.servers.keys()).
every(host => host.endsWith('.mongodb.net:27017'));
const hostnames = Array.from(topologyDescription.servers.keys());
return hostnames.length > 0 &&
hostnames.every(host => host.endsWith('.mongodb.net:27017'));
};