add mongodb-connect middleware