Check MongoDB server is available.

Check MongoDB server is actually available by connecting to the server. If the attempt fails, wait five seconds. It is executed up to five times. Then the script waits the server for 25 seconds in the worst case. This will fix #3.