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.
I haven't tested myself, but this looks like what we talked about implementing. Only suggestion would be to put out some error message that indicated that for some reason the user's system was very slow.
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.