Add retry to connect to mongo db

This patch adds retries to connect to the mongodb, after a restart.

Change-Id: I16e37614736c247fa0b737db2b868c052c2aa33a