db.getReplicationInfo()

Definition

  • db.getReplicationInfo()
  • Returns a document with the status of the replica set, using datapolled from the oplog. Use this output when diagnosingissues with replication.

Output

  • db.getReplicationInfo.logSizeMB
  • Returns the total size of the oplog in megabytes. This refersto the total amount of space allocated to the oplog rather than thecurrent size of operations stored in the oplog.

Starting in MongoDB 4.0, the oplog can grow past its configured sizelimit to avoid deleting the majority commit point.

  • db.getReplicationInfo.usedMB
  • Returns the total amount of space used by the oplog inmegabytes. This refers to the total amount of space currently used byoperations stored in the oplog rather than the total amount of spaceallocated.
  • db.getReplicationInfo.errmsg
  • Returns an error message if there are no entries in the oplog.
  • db.getReplicationInfo.oplogMainRowCount
  • Only present when there are no entries in the oplog. Reports a thenumber of items or rows in the oplog (e.g. 0).
  • db.getReplicationInfo.timeDiff
  • Returns the difference between the first andlast operation in the oplog, represented in seconds.

Only present if there are entries in the oplog.

  • db.getReplicationInfo.timeDiffHours
  • Returns the difference between the first and lastoperation in the oplog, rounded and represented in hours.

Only present if there are entries in the oplog.

  • db.getReplicationInfo.tFirst
  • Returns a time stamp for the first (i.e. earliest)operation in the oplog. Compare this value to the last writeoperation issued against the server.

Only present if there are entries in the oplog.

  • db.getReplicationInfo.tLast
  • Returns a time stamp for the last (i.e. latest)operation in the oplog. Compare this value to the last writeoperation issued against the server.

Only present if there are entries in the oplog.

  • db.getReplicationInfo.now
  • Returns a time stamp that reflects reflecting the current time.The shell process generates this value, and the datum may differslightly from the server time if you’re connecting from a remote hostas a result. Equivalent to Date().

Only present if there are entries in the oplog.