Database Reference
In-Depth Information
hidden
—A Boolean value that, when
true
, will keep this member from show-
ing up in the responses generated by the
isMaster
command. Because the
MongoDB drivers rely on
isMaster
for knowledge of the replica set topology,
hiding a member keeps the drivers from automatically accessing it. This set-
ting can be used in conjunction with
buildIndexes
and must be used with
slaveDelay
.
buildIndexes
—A Boolean value, defaulting to
true
, that determines whether
this member will build indexes. You'll want to set this value to
false
only on
members that will never become primary (those with a priority of 0).
This option was designed for nodes used solely as backups. If backing up
indexes is important, then you shouldn't use this option.
slaveDelay
—The number of seconds that a given secondary should lag behind
the primary. This option can be used only with nodes that will never become pri-
mary. So to specify a
slaveDelay
greater than 0, be sure to also set a priority of 0.
You can use a delayed slave as insurance against certain kinds of user errors.
For example, if you have a secondary delayed by 30 minutes and an administra-
tor accidentally drops a database, then you have 30 minutes to react to this
event before it's propagated.
tags
—A document containing an arbitrary set of key-value pairs, usually used
to identify this member's location in a particular data center or server rack.
Ta g s a r e u s e d f o r s p e c i f y i n g g r a n u l a r w r i t e c o nc e r n a n d r e a d s e t t i n g s , an d
they're discussed in section 8.4.9.
That sums up the options for individual replica set members. There are also two
global replica set configuration parameters scoped under a
settings
key. In the rep-
lica set configuration document, they appear like this:
{
settings: {
getLastErrorDefaults: {w: 1},
getLastErrorModes: {
multiDC: { dc: 2 }
}
}
}
getLastErrorDefaults
—A document specifying the default arguments to be
used when the client calls
getLastError
with no arguments. This option should
be treated with care because it's also possible to set global defaults for
getLast-
Error
within the drivers, and you can imagine a situation where application
developers call
getLastError
not realizing that an administrator has specified a
default on the server.
For more details on
getLastError
, see section 3.2.3 on write concern. Briefly,
to specify that all writes are replicated to at least two members with a timeout of
500 ms, you'd specify this value in the config like so:
settings:
{
getLastError-
Defaults:
{w:
2,
wtimeout:
500}
}
.