Welcome to the MongoDB Community Forums!
In 4.0.27, Mongo response time is around 600 ms, whereas in 4.2.20 it is 1-2 seconds in some occasions, which seems to be a bigger jump.
How are you calculating the response time? It would be great to share details of your deployment topology, and are you running
mongod along with some other processes? Kindly also share the output of
mongostat output from both 4.0.27 & 4.2.20 to make any definitive conclusion.
Response time usually depends on a number of factors like your hardware, number of processes running, your memory, etc. Also, starting MongoDB 4.2 retryable writes are default set to true and MongoDB also removed the 16MB total size limit for a transaction. This may be one of the reasons why your application is having a higher response rate than the previous version.