Added logging and try/catch IN INDEX

The require like mongodb is not needed for all modules. try/catch is
just a temp. fix