Added MongoDB middleware