After a lackluster start to 2023, Wall Street finally started paying attention to MongoDB's (MDB -7.42%) growth potential over the last month. That is, of course, after management presented first-quarter fiscal 2024 results showing good revenue growth and optimism about the business environment and raised fiscal 2024 guidance. The stock popped 28% higher on the news.

The question you might have as an investor is whether you can still invest in MongoDB stock after its huge run-up or whether you missed the rally. Let's discuss this.

The market overvalues MongoDB

MongoDB's stock trades at a price-to-sales (P/S) ratio of 19.24 and a forward P/S ratio of 17.31, which is very high compared to many other high-growth cloud companies. (As seen in the chart below.)

MDB PS Ratio Chart

MDB PS Ratio data by YCharts. PS Ratio = price-to-sales ratio.

It's stunning is that Wall Street would push the valuation this high, especially since the Federal Reserve plans to raise interest rates again, further increasing the possibility of a recession. That's terrible for unprofitable companies.

Since going public in October 2017, MongoDB has yet to achieve profitability. The chart below shows that it has consistently incurred losses over time.

MDB Net Income (Quarterly) Chart

MDB Net Income (Quarterly) data by YCharts.

Most investors hate unprofitable companies during difficult economic times because they view them as risky. When the economy is doing poorly, businesses are more likely to fail, and unprofitable stocks are more likely to go bankrupt.

The chances that this stock could suffer a pullback if the economy worsens are high. So why did many investors pile into this stock after its first-quarter earnings?

It's getting costs under control

A significant concern for MongoDB's long-term success is its high spending in sales and marketing, research and development, and other areas to generate revenue growth. The company must grow its revenue faster than its costs to become profitable, but this has been difficult for several reasons. First, its revenue growth could suffer if it cuts costs too quickly, particularly in sales and marketing. Second, the company's revenue growth has slowed recently due to a slowdown in the overall economy, as seen in the chart below.

MDB Revenue (Quarterly YoY Growth) Chart

MDB Revenue (Quarterly YoY Growth) data by YCharts. YoY = year over year.

In mid-2022, investors became alarmed when they saw MongoDB's operating expenses briefly soar above its revenue, as shown in the chart below.

MDB Total Operating Expenses (Quarterly) Chart

MDB Total Operating Expenses (Quarterly) data by YCharts.

Investors reacted negatively to the resulting decline in operating income, with the company reporting an operating loss of $114.8 million in the second quarter of 2023 (calendar year 2022), down significantly from the operating loss of $75.9 million from the previous quarter. It didn't take long before investors began selling off the stock. By November 2022, the stock had sunk to a 52-week low of $135.15. However, management began rapidly reducing operating costs in the second half of 2022, as shown in the chart below.

MDB Total Operating Expenses (Quarterly YoY Growth) Chart

MDB Total Operating Expenses (Quarterly YoY Growth) data by YCharts. YoY = year over year.

The stock has roughly 100% this year, mainly because investors trust that the company can continue to control costs. They also believe that quarterly year-over-year revenue growth will reaccelerate once the economy recovers, allowing the company to move toward profitability.

What gives investors confidence that revenue growth shall reaccelerate?

Custom software development is a massive growth driver

Custom software development is a significant secular trend, enabling companies to create tailored solutions that meet their needs. Custom-made software can help businesses improve efficiency, automate tasks, and create new revenue streams. Therefore, custom software development is essential for companies to gain a lasting competitive edge. And selecting the most suitable database to support developers in creating that software is a top priority.

Here is what MongoDB's CEO had to say about custom software:

I've said many times in the past, a durable [long-lasting] competitive advantage is built through custom software. It cannot be obtained with an off-the-shelf product. Since most companies understand that they and their competition are all differentiating themselves through software, the speed of software development becomes existential. A McKinsey report found that companies that score in the top quartile of developer velocity generate revenue growth that is four to five times faster than companies in the bottom quartile. MongoDB is built for speed.

Developer velocity is a metric that measures how much work a software development team can complete in a given period. Since MongoDB is a good choice for software development teams that need to be able to quickly and easily build and deploy applications, its database has become an important investment priority for many companies. As long as the trend of companies custom-building their own software continues, MongoDB will attract many customers because of the advantages of its database.

Although the economy is still struggling, MongoDB gained around 2,300 new customers in its first fiscal quarter, its largest number in over two years, which bodes well for future revenue growth.

Is it a buy today?

MongoDB faces many database competitors on the market, such as Couchbase, DynamoDB, and HBase, which offer features and functionality similar to MongoDB. It could lose market share and revenue if it fails to differentiate itself from its competitors, requiring significant spending in research and development to stay ahead. And if it spends too heavily to maintain market share, it could sink further into unprofitability. This company may ultimately find it challenging to balance increasing revenue, controlling costs, and competing effectively in the database marketplace.

Holding your shares could be a good idea if you own them, as there is the potential for significant gains. However, given MongoDb's risks and high valuation, it may be wise for potential new investors to wait for a more reasonable price or consider other stocks with better valuations.