Store history entries in MongoDB.