added mongodb storage of historical data