Squash oplog on single node replica set

I have enabled replicaSet on a single node mongodb, in order to be able to use the watch functionality. I do not wish to use more than one mongo instance.

My requirement is to get current data in the collections, and monitor for future updates. watch({startAtOperationTime: 0}) works brilliantly for that.

However I never care about the history before now, and I do not want to use any significant storage space for the oplog.

Is there any way to configure mongo to immediate or very fast squash the history in the oplog? Can I just set the oplog to a very low value (how low?), or set some timeout?

Hi @Morten_Laursen

The default OpLog size is the larger of 990MB or 5% of the volume of the dbPath

But the storage size of this collection is often smaller than the this value due to compression used by the storage engine.

990M is the smallest configurable value.

2 Likes