getReplicationInfo at realm?

is it possible to run this at realm function?

db.getReplicationInfo () .timeDiffHours

db.getReplicationInfo() is a helper function in the mongo shell and so isn’t available to a Realm function…

TypeError: 'getReplicationInfo' is not a function
	at exports (function.js:5:17(25))
	at function_wrapper.js:3:29(21)
	at <eval>:11:8(3)
	at <eval>:2:15(7)

What problem are you trying to solve with this function?

I try to set up a throttling at realm function to avoid opLog < 1hr when I am doing a bulk insert().

My idea was, if db.getReplicationInfo().timeDiffHours < 1 then I should slow down the consumer for bulk insertion.

any workaround?

please advise, Thanks!

One option could be to configure and react to Atlas replication oplog alerts (https://docs.atlas.mongodb.com/reference/alert-conditions/#replication-oplog). There are a number of ways to consume those alerts, but it’s going a bit beyond my knowledge and the scope of this category.

I’d suggest posting a question to Ops and Admin - MongoDB Developer Community Forums in addition to keeping this topic open.