new Mongos(servers, options){Mongos}
Creates a new Mongos instance
Name | Type | Default | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
servers |
Array.<Server> |
A seedlist of servers participating in the replicaset. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
object | null |
optional
Optional settings.
|
- Deprecated
- Yes
Properties:
Name | Type | Description |
---|---|---|
parserType |
string | the parser type used (c++ or js). |
Fires:
- Mongos#event:connect
- Mongos#event:ha
- Mongos#event:joined
- Mongos#event:left
- Mongos#event:fullsetup
- Mongos#event:open
- Mongos#event:close
- Mongos#event:error
- Mongos#event:timeout
- Mongos#event:parseError
Returns:
Mongos instance.Methods
-
connections(){array}
-
All raw connections
-
unref()
-
Unref all sockets
Events
-
close
-
Mongos close event
Type:
- object
-
connect
-
A mongos connect event, used to verify that the connection is up and running
Type:
-
error
-
Mongos error event, emitted if there is an error listener.
Type:
-
fullsetup
-
Mongos fullsetup event, emitted when all proxies in the topology have been connected to.
Type:
-
The mongos high availability event
Type:
- function
Name Type Description type
string The stage in the high availability event (start|end)
data.norepeat
boolean This is a repeating high availability process or a single execution only
data.id
number The id for this high availability request
data.state
object An object containing the information about the current replicaset
-
joined
-
A server member joined the mongos set
Type:
- function
Name Type Description type
string The type of member that joined (primary|secondary|arbiter)
server
Server The server object that joined
-
left
-
A server member left the mongos set
Type:
- function
Name Type Description type
string The type of member that left (primary|secondary|arbiter)
server
Server The server object that left
-
open
-
Mongos open event, emitted when mongos can start processing commands.
Type:
-
parseError
-
Mongos parseError event
Type:
- object
-
timeout
-
Mongos timeout event
Type:
- object