add error log in connecting to mongodb