Implemented the logic regarding MongoDB and updates the views correspondingly.