isAtlas.js 401 B

12345678910111213
  1. 'use strict';
  2. const getConstructorName = require('../getConstructorName');
  3. module.exports = function isAtlas(topologyDescription) {
  4. if (getConstructorName(topologyDescription) !== 'TopologyDescription') {
  5. return false;
  6. }
  7. const hostnames = Array.from(topologyDescription.servers.keys());
  8. return hostnames.length > 0 &&
  9. hostnames.every(host => host.endsWith('.mongodb.net:27017'));
  10. };