MongoDB Driver API for Node.js (original) (raw)

Class: Server

Server

Creates a new Server instance

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

Name Type 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 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 boolean false optional Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher) checkServerIdentity boolean|function true optional Ensure we check server identify during SSL, set to false to disable checking. Only works for Node 0.12.x or higher. You can pass in a boolean or your own checkServerIdentity override function. sslCA array optional Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher) sslCRL array optional Array of revocation certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher) sslCert Buffer
Properties:
Name Type Description
parserType string the parser type used (c++ or js).

Deprecated

Fires:
Returns:

Server instance.

Events

close

Server close event

Type:

commandFailed

An event emitted indicating a command failed, if command monitoring is enabled

Type:

commandStarted

An event emitted indicating a command was started, if command monitoring is enabled

Type:

commandSucceeded

An event emitted indicating a command succeeded, if command monitoring is enabled

Type:

connect

Server connect event

Type:

error

Server error event

Type:

parseError

Server parseError event

Type:

reconnect

Server reconnect event

Type:

timeout

Server timeout event

Type: