added AbstractMiddleware and MongoDB backend implementation