What happened

Shares of MongoDB (MDB 4.83%) were flying higher last month as improving investor sentiment drove a recovery among cloud stocks, and the company benefited from some bullish analyst chatter.

While there was little company-specific news out on the database software business, the improving macroeconomic picture favored the stock.

According to data from S&P Global Market Intelligence, the stock finished the month up 20%, though the chart below shows that it wasn't a smooth ride.

Chart showing MongoDB's major ups and downs in July, with it finishing higher than when it started, and outperforming the S&P 500.

^SPX data by YCharts

So what

The best day of the month for MongoDB came on July 5, when the stock jumped 13% on high-volume trading. Though there was no news out on the company, the Nasdaq popped as oil prices fell below $100 a barrel for the first time since early May, a sign that inflation concerns were easing, helping to avert a recession. Long-dated bond yields also fell, which helped expensive tech stocks with long-dated earnings like MongoDB. That's because falling interest rates lead to a lower discount rate, which makes earnings in the future worth more, according to typical financial models.

The following week, MongoDB stock fell 6.3% after bearish comments from ServiceNow CEO Bill McDermott weighed on the broader software sector. That sell-off overshadowed an analyst endorsement as Baird initiated coverage on MongoDB with an outperform rating. Analyst William Power said MongoDB had established itself as the clear next-generation database leader, and sees strong growth ahead with a large addressable market.

Finally, shares surged over the last week of July as investors reacted favorably to comments from Fed Chair Jerome Powell, who said he did not believe the U.S. was in a recession. Though the central bank also raised the benchmark interest rate by 75 basis points that day, July 27, stocks soared on hopes that inflation could be brought to heel without causing a recession.

Now what

MongoDB stock is still down about 40% from its peak, largely for valuation reasons, like much of the cloud software sector. Currently, the stock trades at a still-lofty price-to-sales ratio of 23 and is not profitable, though it is growing quickly.

That valuation means that macroeconomics like interest rates and recession forecasts will likely continue to move the stock for the foreseeable future. Still, long-term investors should keep their eye on the business's performance, especially Atlas, its cloud-based database product that has delivered eyepopping growth.