skip to content

What are hidden, delayed, and priority-0 members in a MongoDB replica set used for?

level: seniorimportance: should knowfreq 42%

answer

  1. All three still hold the full data set
  2. One of them clients cannot see at all
  3. One is deliberately behind on purpose
  4. Compare its lag against the oplog window
  5. It guards against a mistake, not a disk failure

basics

~20 s

They are full data-bearing secondaries carrying special restrictions. A priority-0 member replicates but can never be primary; a hidden member is additionally invisible to client read preference; a delayed member deliberately lags by a fixed interval as a rolling undo window.

solid answer

~50 s

All three are ordinary data-bearing secondaries that replicate the oplog normally — the options only restrict how they participate. `priority: 0` makes a member ineligible to become primary, useful for a node in a remote region or on weaker hardware that you never want serving writes. `hidden: true` implies `priority: 0` and additionally keeps the member out of the topology clients see, so no read preference will route queries to it; that is how you dedicate a node to backups or analytics without stealing capacity from live traffic. `secondaryDelaySecs` makes a member apply oplog entries only after a fixed delay, so it holds the data set as it was N seconds ago. A delayed member must be `priority: 0` and should be hidden, and the delay must be shorter than the oplog window — otherwise it can never catch up.

code

javascript · 5 lines
javascript
cfg = rs.conf()
cfg.members[3].priority = 0
cfg.members[3].hidden = true
cfg.members[3].secondaryDelaySecs = 3600
rs.reconfig(cfg)

go deeper

for a junior

Recall that these are still full copies of the data, and that a delayed member intentionally lags so you can recover from a recent mistake.

for a middle

Explain each option's exact effect — never electable, invisible to read preference, applies entries late — and know that hidden implies priority 0.

for a senior

Show the operational reasoning: pick a delay from your realistic detection time, check it against the oplog window, and explain why a delayed member must be non-electable and hidden.

for a principal

Own the composition: which dedicated members the topology funds, what each buys against backup and restore alternatives, and how the delay interacts with detection tooling and recovery objectives.

## The common ground All three are **data-bearing secondaries**. They tail the oplog, hold a complete copy of the data set, and count as real redundancy. Nothing here resembles an arbiter, which stores nothing. What changes is only how the member participates in serving traffic and in becoming primary. ## priority: 0 A member with `priority: 0` replicates normally but is never eligible to become primary. It is still visible to clients, so it can serve secondary reads, and it still contributes a copy of the data. The typical reasons to use it: the member is in a distant region where promoting it would put the write path across an ocean; it runs on cheaper hardware that could not carry the write load; or it exists for a dedicated job and you want a guarantee that no automatic promotion will ever hand it production traffic. ## hidden: true A hidden member sets `priority: 0` implicitly and adds one thing: it is not advertised to client applications, so no read preference — not `secondary`, not `nearest`, not a tag-set match — will route a query to it. It replicates like any other secondary and it can still vote. This is the standard way to dedicate capacity. Point a nightly backup, a heavy reporting job, or an analytics extract at a hidden member and it consumes no capacity that live traffic depends on. Because it is invisible to drivers, adding or removing it does not perturb client routing. ## secondaryDelaySecs A delayed member intentionally applies oplog entries only after a configured interval, so its copy of the data reflects the state of the set as it was that long ago. Setting `secondaryDelaySecs: 3600` gives you a rolling one-hour-old copy, continuously maintained. What it protects against is not hardware failure — replication already covers that. It protects against **logical destruction**: someone drops a collection, runs an unfiltered `updateMany`, or a bad deploy corrupts documents. Ordinary replication propagates that mistake to every secondary within milliseconds. A delayed member has not applied it yet, so for the length of the delay you have a live, consistent copy of the data as it was before the mistake — recovered by taking its files rather than by restoring last night's backup and replaying. The constraints matter: - It **must** be `priority: 0`. Promoting a member that is deliberately an hour behind would discard an hour of writes. - It **should** be `hidden: true`, or read-preference traffic would be served stale data by a member that is stale by design. - The delay **must be shorter than the oplog window**. The member is, by construction, permanently that far behind — if the delay approaches the window, ordinary jitter pushes it outside and it goes stale and needs a rebuild. A one-hour delay against a ninety-minute window is a trap; against a thirty-hour window it is comfortable. - The delay sets your detection budget. A one-hour delay is only useful if a human or an alert notices the damage within the hour. Choosing it is really choosing how fast you believe you detect destructive mistakes. ## Configuring them All three are member fields in the replica set configuration, applied with `rs.reconfig()`. They can be combined — a delayed member is normally hidden and priority-0 at once. A related option, `buildIndexes: false`, exists for members that only ever supply file-level copies and never serve queries; it is rare and cannot be set on a member that might serve reads. ## Where they fit Think of them as three independent restrictions rather than three member types: can it be promoted, can clients see it, and does it apply changes now or later. Real deployments compose them — a hidden priority-0 analytics node, a hidden delayed safety copy, a priority-0 visible node in a secondary region for local reads — and each combination is a deliberate answer to a specific operational need.

  • Why must a delayed member's delay be shorter than the oplog window?
    The member is permanently that far behind by design. If the delay approaches the window, any additional jitter — a write burst, a slow disk — pushes its position past the oldest retained oplog entry, and it becomes too stale to resume tailing. It then needs a full rebuild, and you have lost the very safety copy you were paying for.
  • What does a delayed member protect against that a hidden analytics secondary does not?
    Logical destruction. A dropped collection or an unfiltered updateMany replicates to every normal secondary within milliseconds, including a hidden one. A delayed member has not applied it yet, so for the length of the delay you hold a live, consistent pre-mistake copy of the data and can recover from its files instead of restoring and replaying a backup.
  • Can a hidden member still vote in the replica set?
    Yes. Hidden only controls visibility to client applications — drivers are not told about the member, so no read preference routes queries to it. It remains a full data-bearing secondary and can still be a voting member, which is worth remembering when you count voters while planning maintenance.

saying these in an interview costs you the question

  • Thinks hidden members do not replicate the full data set
  • Sets a delay longer than the oplog window
  • Leaves a delayed member electable
  • Expects a delayed member to protect against disk failure
  • Confuses a hidden member with an arbiter

context