Class: Server

Server

new Server(host, port, options){Server}

Creates a new Server instance

Name Type Default Description
host string

The host for the server, can be either an IP4, IP6 or domain socket style host.

port number optional

The server port if IP4.

options object null optional

Optional settings.

Name Type Default Description
poolSize number 5 optional

Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons.

ssl boolean false optional

Use ssl connection (needs to have a mongod server with ssl support)

sslValidate object false optional

Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher)

sslCA array null optional

Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher)

sslCert Buffer | string null optional

String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher)

sslKey Buffer | string null optional

String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher)

sslPass Buffer | string null optional

String or buffer containing the certificate password (needs to have a mongod server with ssl support, 2.4 or higher)

socketOptions object null optional

Socket options

Name Type Default Description
autoReconnect boolean false optional

Reconnect on error.

noDelay boolean true optional

TCP Socket NoDelay option.

keepAlive number 0 optional

TCP KeepAlive on the socket with a X ms delay before start.

connectTimeoutMS number 0 optional

TCP Connection timeout setting

socketTimeoutMS number 0 optional

TCP Socket timeout setting

Deprecated
  • Yes
Fires:
Returns:
Server instance.

Methods

connections(){array}

All raw connections

Events

Server close event

Type:
  • object

Server connect event

Type:
  • object

Server error event

Type:
  • MongoError

parseError

Server parseError event

Type:
  • object

reconnect

Server reconnect event

Type:
  • object

Server timeout event

Type:
  • object
comments powered by Disqus
Documentation generated by JSDoc 3.3.0-alpha9 on Wed Oct 29 2014 13:10:24 GMT+0100 (CET)