Rebase fix for Mongo middleware