MongoDB sleep command

I am using MongoDB version 4.0, and I want to delay mongodb fsyncLock for test purpose. Please can you suggest any way to achieve this?
Also is it possible to make MongoDB sleep?

Hi @Akshaya_Srinivasan,

The fsyncLock command is sent from a client or driver, so you should be able to add a sleep/delay if the client or driver supports one.

This would just be a delay in sending the command to your MongoDB deployment. The server does not have a concept of “sleeping”.

For example, using sleep() in the mongo shell to suspend client-side execution for 1 second before sending a command:

sleep(1000); db.fsyncLock()

Regards,
Stennie

Thanks Stennie. Also this helped when tried from python.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.