Why mongodb logs commands in the log file and how to avoid that?
To increase the slowms value , follow the below steps:

For Exmple, If you want to increase the slowms vlaue to 500ms

db.setProfilingLevel(1, 500)


It will set the slowms to 500ms and will also turn on the profiling. So to stop the profiling, run the below command.

db.setProfilingLevel(0)


This can also be done by restarting MongoDB with the --slowms option.

Now, the commands will get logged in the log file only when the command takes more than 500ms to execute.