MongoDB: The Optime
Mongo records all operations that modify the data in a replica set in the oplog. Each entry in the oplog has a special timestamp called the optime.
The optime is a couple of integers: a first value which is a timestamp with precision to the second, and a 32 bit incremental value for operations "in the same second". So, basically, every time the first value increases, the second one restarts from zero.
Secondary members of the set will receive the optime from the primary with the statement they synchronize to, and store it unchanged. So, on secondaries the last optime states which operation has just been received from the primary and is now executing locally.
In the Replica Set Admin UI you can get the optime for the last entry in all the members of a replica set, and that gives a simple way to see if some servers are lagging behind the primary: it shows both how much time and how many operations the secondary is behind.














