src/mongo/shell/replsettest.js
/**
     * Constructor, which instantiates the ReplSetTest object from an existing set.
     */
Constructor, which instantiates the ReplSetTest object from an existing set.
Constructor which instantiates the ReplSetTest object from an existing set .
function _constructFromExistingSeedNode(seedNode) {
        const conn = new Mongo(seedNode);
        if (jsTest.options().keyFile) {
            self.keyFile = jsTest.options().keyFile;
        }
        var conf = asCluster(conn, () => _replSetGetConfig(conn));
        print('Recreating replica set from config ' + tojson(conf));
        var existingNodes = conf.members.map(member => member.host);
        self.ports = existingNodes.map(node => node.split(':')[1]);
        self.nodes = existingNodes.map(node => {
            let conn = new Mongo(node);
            conn.name = conn.host;
            return conn;
        });
        self.waitForKeys = false;
        self.host = existingNodes[0].split(':')[0];
        self.name = conf._id;
    }
function _constructFromExistingSeedNode ( seedNode ) { const conn = new Mongo ( seedNode ) ; if ( jsTest . options ( ) . keyFile ) { self . keyFile = jsTest . options ( ) . keyFile ; } var conf = asCluster ( conn , ( ) => _replSetGetConfig ( conn ) ) ; print ( 'Recreating replica set from config ' + tojson ( conf ) ) ; var existingNodes = conf . members . map ( member => member . host ) ; self . ports = existingNodes . map ( node => node . split ( ':' ) [ 1 ] ) ; self . nodes = existingNodes . map ( node => { let conn = new Mongo ( node ) ; conn . name = conn . host ; return conn ; } ) ; self . waitForKeys = false ; self . host = existingNodes [ 0 ] . split ( ':' ) [ 0 ] ; self . name = conf . _id ; }
Constructor, which instantiates the ReplSetTest object from an existing set.
Constructor which instantiates the ReplSetTest object from an existing set .
// Note: the seed node is required to be operational in order for the Mongo // shell to connect to it. In this code there is no fallback to other nodes.