Adding connection hook for mongodb

[merge]