Creates a new Server instance
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 DescriptionpoolSize
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 | string optional
String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher)
ciphers
string optional
Passed directly through to tls.createSecureContext. See https://nodejs.org/dist/latest-v9.x/docs/api/tls.html#tls_tls_createsecurecontext_options for more info.
ecdhCurve
string optional
Passed directly through to tls.createSecureContext. See https://nodejs.org/dist/latest-v9.x/docs/api/tls.html#tls_tls_createsecurecontext_options for more info.
sslKey
Buffer | string 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 optional
String or buffer containing the certificate password (needs to have a mongod server with ssl support, 2.4 or higher)
servername
string optional
String containing the server name requested via TLS SNI.
socketOptions
object optional
Socket options
Name Type Default DescriptionautoReconnect
boolean true optional
Reconnect on error.
noDelay
boolean true optional
TCP Socket NoDelay option.
keepAlive
boolean true optional
TCP Connection keep alive enabled
keepAliveInitialDelay
number 120000 optional
The number of milliseconds to wait before initiating keepAlive on the TCP socket
connectTimeoutMS
number 10000 optional
How long to wait for a connection to be established before timing out
socketTimeoutMS
number 0 optional
How long a send or receive on a socket can take before timing out
reconnectTries
number 30 optional
Server attempt to reconnect #times
reconnectInterval
number 1000 optional
Server will wait # milliseconds between retries
monitoring
boolean true optional
Triggers the server instance to call ismaster
haInterval
number 10000 optional
The interval of calling ismaster when monitoring is enabled.
domainsEnabled
boolean false optional
Enable the wrapping of the callback in the current domain, disabled by default to avoid perf hit.
monitorCommands
boolean false optional
Enable command monitoring for this topology
parserType
string
the parser type used (c++ or js).
Server close event
Type:An event emitted indicating a command failed, if command monitoring is enabled
Type:An event emitted indicating a command was started, if command monitoring is enabled
Type:An event emitted indicating a command succeeded, if command monitoring is enabled
Type:Server connect event
Type:Server error event
Type:Server parseError event
Type:Server reconnect event
Type:Server timeout event
Type:RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4