How to use the mongodb.Mongos function in mongodb

To help you get started, we’ve selected a few mongodb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github christkv / mongodb-proxy / lib / connection.js View on Github external
}
    
    // Save the db reference
    self.db = db;

    // Log info about mongodb connection
    if(self.logger.isInfo()) self.logger.info(f('correctly connected to MongoDB topology for client connection %s:%s'
      , remoteAddress
      , remotePort));

    // Unpack the mongodb-core
    if(self.db.serverConfig instanceof m.Server) {
      self.topology = self.db.serverConfig.s.server;
    } else if(self.db.serverConfig instanceof m.ReplSet) {
      self.topology = self.db.serverConfig.s.replset;
    } else if(this.db.serverConfig instanceof m.Mongos) {
      self.topology = self.db.serverConfig.s.mongos;
    }

    // Connection closed by peer
    connection.on('end', function() {
      if(self.logger.isInfo()) self.logger.info(f('connection closed from %s:%s'
        , remoteAddress
        , remotePort));
      // Shut down db connection
      db.close();
    });

    // Data handler
    connection.on('data', dataHandler(self));

    // Data handler
github dwyl / app / node_modules / mongoose / lib / drivers / node-mongodb-native / connection.js View on Github external
/*!
 * Module dependencies.
 */

var MongooseConnection = require('../../connection')
  , mongo = require('mongodb')
  , Db = mongo.Db
  , Server = mongo.Server
  , Mongos = mongo.Mongos
  , STATES = require('../../connectionstate')
  , ReplSetServers = mongo.ReplSetServers;

/**
 * A [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) connection implementation.
 *
 * @inherits Connection
 * @api private
 */

function NativeConnection() {
  MongooseConnection.apply(this, arguments);
  this._listening = false;
};

/**
github SubhasisDutta / Android-APK-Analysis / node_modules / mongoose / lib / drivers / node-mongodb-native / connection.js View on Github external
/*!
 * Module dependencies.
 */

var MongooseConnection = require('../../connection'),
    mongo = require('mongodb'),
    Db = mongo.Db,
    Server = mongo.Server,
    Mongos = mongo.Mongos,
    STATES = require('../../connectionstate'),
    ReplSetServers = mongo.ReplSet;

/**
 * A [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) connection implementation.
 *
 * @inherits Connection
 * @api private
 */

function NativeConnection() {
  MongooseConnection.apply(this, arguments);
  this._listening = false;
}

/**
github galaxykate / techne / node_modules / mongoose / lib / drivers / node-mongodb-native / connection.js View on Github external
/*!
 * Module dependencies.
 */

var MongooseConnection = require('../../connection');
var mongo = require('mongodb');
var Db = mongo.Db;
var Server = mongo.Server;
var Mongos = mongo.Mongos;
var STATES = require('../../connectionstate');
var ReplSetServers = mongo.ReplSet;
var DisconnectedError = require('../../error/disconnected');

/**
 * A [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) connection implementation.
 *
 * @inherits Connection
 * @api private
 */

function NativeConnection() {
  MongooseConnection.apply(this, arguments);
  this._listening = false;
}
github paulcsmith / mongoose-currency / node_modules / mongoose / lib / drivers / node-mongodb-native / connection.js View on Github external
/*!
 * Module dependencies.
 */

var MongooseConnection = require('../../connection')
  , mongo = require('mongodb')
  , Db = mongo.Db
  , Server = mongo.Server
  , Mongos = mongo.Mongos
  , STATES = require('../../connectionstate')
  , ReplSetServers = mongo.ReplSet
  , utils = require('../../utils');

/**
 * A [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) connection implementation.
 *
 * @inherits Connection
 * @api private
 */

function NativeConnection() {
  MongooseConnection.apply(this, arguments);
  this._listening = false;
};
github agabardo / nyc_restaurants / nycRestaurants / node_modules / mongoose / lib / drivers / node-mongodb-native / connection.js View on Github external
/*!
 * Module dependencies.
 */

var MongooseConnection = require('../../connection');
var mongo = require('mongodb');
var Db = mongo.Db;
var Server = mongo.Server;
var Mongos = mongo.Mongos;
var STATES = require('../../connectionstate');
var ReplSetServers = mongo.ReplSet;
var DisconnectedError = require('../../error/disconnected');

/**
 * A [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) connection implementation.
 *
 * @inherits Connection
 * @api private
 */

function NativeConnection() {
  MongooseConnection.apply(this, arguments);
  this._listening = false;
}
github joshlobaptista / Barista-Fullstack / node_modules / mongoose / lib / drivers / node-mongodb-native / connection.js View on Github external
/*!
 * Module dependencies.
 */

var MongooseConnection = require('../../connection');
var mongo = require('mongodb');
var Db = mongo.Db;
var Server = mongo.Server;
var Mongos = mongo.Mongos;
var STATES = require('../../connectionstate');
var ReplSetServers = mongo.ReplSet;
var DisconnectedError = require('../../error/disconnected');

/**
 * A [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) connection implementation.
 *
 * @inherits Connection
 * @api private
 */

function NativeConnection() {
  MongooseConnection.apply(this, arguments);
  this._listening = false;
}
github alfred / mean-skeleton / node_modules / mongoose / lib / drivers / node-mongodb-native / connection.js View on Github external
/*!
 * Module dependencies.
 */

var MongooseConnection = require('../../connection')
  , mongo = require('mongodb')
  , Db = mongo.Db
  , Server = mongo.Server
  , Mongos = mongo.Mongos
  , STATES = require('../../connectionstate')
  , ReplSetServers = mongo.ReplSetServers
  , utils = require('../../utils');

/**
 * A [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) connection implementation.
 *
 * @inherits Connection
 * @api private
 */

function NativeConnection() {
  MongooseConnection.apply(this, arguments);
  this._listening = false;
};
github dinubs / jam-api / node_modules / mongoose / lib / drivers / node-mongodb-native / connection.js View on Github external
/*!
 * Module dependencies.
 */

var MongooseConnection = require('../../connection'),
    mongo = require('mongodb'),
    Db = mongo.Db,
    Server = mongo.Server,
    Mongos = mongo.Mongos,
    STATES = require('../../connectionstate'),
    ReplSetServers = mongo.ReplSet;

/**
 * A [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) connection implementation.
 *
 * @inherits Connection
 * @api private
 */

function NativeConnection() {
  MongooseConnection.apply(this, arguments);
  this._listening = false;
}

/**
github bfrgoncalves / Online-PhyloViZ / node_modules / mongoose / lib / drivers / node-mongodb-native / connection.js View on Github external
/*!
 * Module dependencies.
 */

var MongooseConnection = require('../../connection');
var mongo = require('mongodb');
var Db = mongo.Db;
var Server = mongo.Server;
var Mongos = mongo.Mongos;
var STATES = require('../../connectionstate');
var ReplSetServers = mongo.ReplSet;
var DisconnectedError = require('../../error/disconnected');

/**
 * A [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) connection implementation.
 *
 * @inherits Connection
 * @api private
 */

function NativeConnection() {
  MongooseConnection.apply(this, arguments);
  this._listening = false;
}