Add middleware for validating Mongo id's