The error was solved by the format of connection (using the parameters maxIdleTimeMS, SSL, and authSource):
maxIdleTimeMS – the maximum number of milliseconds that a connection can remain idle in the pool before being removed and closed.
Solution: Modify the database connection like below:
spring.data.mongodb.uri=mongodb+srv://admin:admin123@cluster0.hvjmw.mongodb.net/orders?retryWrites=true&w=majority&maxIdleTimeMS=15000
Hope it will help