Adding connection hook for mongodb