Salesforce(NYSE: CRM) and MongoDB(NASDAQ: MDB) represent two different ways to invest in the growing cloud market. Salesforce is the world's largest provider of cloud-based customer relationship management (CRM) services, and it provides additional marketing, e-commerce, analytics, and enterprise collaboration services. MongoDB helps companies organize their unstructured data with its database services.
Over the past five years, Salesforce's stock has risen about 60% as MongoDB's stock rallied more than 90%. Let's see why the smaller database provider outperformed the CRM leader -- and if that trend will continue for the foreseeable future.
Salesforce pivots from growth toward profitability
From fiscal 2018 to fiscal 2023 (which ended in January 2023), Salesforce's revenue grew at a compound annual growth rate (CAGR) of 24% as its adjusted earnings per share (EPS) rose at a CAGR of 31%. Some of that growth was organic, but a lot of it came from big acquisitions like Mulesoft, Tableau, and Slack. But as its growth slowed down in the second half of fiscal 2023, it was besieged by several activist investors.
To appease those activists, Salesforce laid off thousands of employees, paused its large acquisitions, approved a big buyback plan, and initiated its first dividend. In fiscal 2024, Salesforce's revenue only rose 11% but its adjusted operating margin expanded 800 basis points to 30.5% as its adjusted EPS jumped 57%. It's bought back $18.1 billion in shares (from its $30 billion authorization) since the start of fiscal 2023.
For fiscal 2025, Salesforce expects its revenue to only grow 8%-9%, its adjusted operating margin to rise to 32.5%, and for its adjusted EPS to increase 22%-23%. It mainly attributes its slowing sales growth to the macro headwinds, but it also faces stiff competition from other cloud giants like Microsoft and Adobe. It's also focusing more on boosting its bottom line instead of acquiring more companies.
Salesforce's prioritization of profit growth over revenue growth indicates its business is maturing. It's been rolling out more generative AI tools to analyze data and automate tasks across its ecosystem, but those services aren't moving the needle or boosting its sales yet. Its stock looks reasonably valued at 26 times forward earnings, but its low forward yield of 0.6% won't attract any serious income investors in this high interest rate environment.
MongoDB is bracing for a major slowdown
From fiscal 2018 to fiscal 2023 (which also ended in January 2023), MongoDB's revenue grew at a CAGR of 51%. It also turned profitable on an adjusted basis in fiscal 2023.
MongoDB grew rapidly because its non-relational database, which collected unstructured data, was more flexible and customizable than older relational databases which relied on rigid tables and charts. Its cloud-based Atlas service could also be integrated into a wide range of cloud infrastructure platforms like Amazon Web Services (AWS) and Microsoft Azure, which made it an attractive option for companies which used multiple cloud services.
In fiscal 2024, MongoDB's revenue grew 31%, its adjusted operating margin more than tripled to 16.1%, and its adjusted EPS surged 311%. But for fiscal 2025, it expects its revenue to only grow 14%-15%, its adjusted operating margin to dip to about 10%, and for its adjusted EPS to decline 26%-30%.
It blames that deceleration on the macro headwinds, reduced upfront commitment requirements for new customers, difficult year-over-year comparisons to some big multiyear deals in fiscal 2024, and the slower growth of its non-Atlas services. It also expects the expansion of its sales teams to squeeze its margins as its growth cools off.
That mix of slowing growth and declining margins is worrisome, but MongoDB's stock still looks expensive at 130 times forward earnings estimates. The bulls might be expecting its growth to accelerate again as companies store more data on its platform to support their new AI services, but I'm not sure those expectations justify such a lofty valuation.
The better buy: Salesforce
I wouldn't rush to buy either of these stocks. Salesforce's tight focus on its profits could inadvertently erode its defenses and throttle its long-term sales growth, while MongoDB still needs to overcome a lot of macro and competitive headwinds.
But if I had to choose one over the other right now, I'd pick Salesforce because it's bigger, better diversified, has higher operating margins, and trades at a more reasonable valuation. MongoDB might keep growing, but its sales growth needs to stabilize with expanding margins again before I consider it to be a worthwhile investment.
John Mackey, former CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool's board of directors. Leo Sun has positions in Amazon. The Motley Fool has positions in and recommends Adobe, Amazon, Microsoft, MongoDB, and Salesforce. The Motley Fool recommends the following options: long January 2026 $395 calls on Microsoft and short January 2026 $405 calls on Microsoft. The Motley Fool has a disclosure policy.