How to Restore Data to a Specific Point in Time Using a Delayed Replica set member?

I have a MongoDB replica set. One of the members is a delayed replica set member that is delayed by 24 hours (slaveDelay=86400`). I have everything required to restore the database to its state at any point within the past 24 hours. But how to achieve this?

mongorestore has a usefull option --oplogLimit=<timestamp>. However, I’m unable to find way to get a dump that will contain delayed DB and oplog with entries up to the current time.

mongodump has the option --oplog that allows dump to contain oplog entries that occur during the mongodump operation. So if I dump from a delayed replica set member I get oplog with entries with changes that were applied to delayed DB during mongodump run. But how can I dump delayed DB with the whole oplog that exits in the replica set? I would like to get oplog that includes entries up to the current moment. Is this possible?

The closest I found is this explanation: Modify and replay MongoDB oplog - Stack Overflow but I’m sure a simpler solution should exist!

It looks like I found answer to my question in this article: ZFS For MongoDB Backups All I need is

  1. to get latest oplog entry in delayed replicaset member dump (coping commands from the article, I’ll try to do that later):

revin@mongodb:~$ mongo --port 28021 local --quiet
–eval ‘db.oplog.rs.find({},{ts: 1}).sort({ts: -1}).limit(1)’
{ “ts” : Timestamp(1555356271, 1) }

  1. dump oplog from not delayed replicat set member (this is what I needed!!!):

revin@mongodb:~/mongodump28020$ mongodump --port 28020 -d local -c oplog.rs
–query ‘{ts: {$gt: Timestamp(1555356271, 1)}}’

  1. and then using mongorestore to apply date up to needed point in time:

revin@mongodb:~/mongodump28020$ mongorestore --port 28021 --dir=dump/ --oplogReplay --oplogLimit 1555356302 -vvv

I need to test this!