Why is MongoDB oplog size different between servers I have a ReplicaSet running fine once I ran rs.stepDown() and looking for rs.status() I get fine logs.

Here is one as evidence:

rsdev:SECONDARY&gt; db.printSlaveReplicationInfo()
source: lab:27017
    syncedTo: Mon Jul 17 2017 09:20:52 GMT-0300 (BRT)
    0 secs (0 hrs) behind the primary 


I got one problem with my application that if I change the primary to the server X which used to be the secondary than I just can't use its oplog as I was when using server Y as primary.

I know that when I have  a new member in the ReplicaSet it may will have the dataSet size smaller than its primary due to its age, delete, insert and so on.

But should its oplog size be different between them?

rsdev:PRIMARY&gt; db.getReplicationInfo().usedMB
40543.1

rsdev:SECONDARY&gt;  db.getReplicationInfo().usedMB
21734.5


This secondary server is the new one which I get into problem if become primary.

Both using wiredTiger storage.
If you haven't defined in config (file or parameter; replication.oplogSizeMB) what size of opLog you wanted when node was initialized, it is automatically set base on free space on data disk. In wireTiger it's 5% of free disk space (990MB-50GB).

You can change that oplog size if you want, but after that you need to wait until it's full.