Added check for mongodb existence