Cloud stocks have been fantastic investments over the past couple of years. For instance, since MongoDB (NASDAQ:MDB) had its IPO in October of 2017, it has returned 330% to its investors. Another cloud company, Datadog (NASDAQ:DDOG), had its IPO last week. The market has already priced in a lot of future growth for Datadog, awarding the stock a valuation 40 times higher than the company's revenues. What will the future be like for these software-as-a-service (SaaS) titans? 

Dollars rain on people in suits

Source: Getty Images 

A Mongo monster

MongoDB is a database company focused on the cloud. One of its competitors, Oracle (NYSE:ORCL), has a $180 billion market cap. In comparison, MongoDB is tiny at $7.4 billion. Oracle's size shows just how much money is to be made in database software (a lot). And Oracle has dominated this business for many, many years. So that's the first question a MongoDB investor needs to think about: How can our company compete against Oracle?

The answer lies in the current revolution we are witnessing in database software. There is the old school, dominated by Oracle; its software is based on SQL, or "structured query language." Oracle's software is designed for data that's in spreadsheets and other tables. And now there's the new form of database software, dominated by MongoDB, called NoSQL. This software is designed for unstructured data -- basically any data that is not in a spreadsheet. Imagine how vast that swamp is. Unstructured data includes emails, blog posts, text messages, videos, audio files, satellite images, spreadsheets themselves, and much more.

Oracle has wonderful software for manipulating data -- as long as it's in spreadsheets. If you're talking about any other form of data, NoSQL is far superior. It should surprise no one that Oracle's growth has stalled as other forms of data grow more prevalent. Meanwhile, MongoDB's growth has been spectacular. It had revenue of $99.4 million last quarter, and it's expanding revenue at 67% a year. But the real star has been Atlas, the company's database software in the cloud, which is growing by an astounding 240% a year. Almost a third of MongoDB's revenue now comes from Atlas.

Indeed, the shift to the cloud has been rocking the software industry for a few years now. It's not just Oracle that is feeling the heat. We're seeing SaaS revolutions across the entire spectrum of software, including cybersecurity, analytics, tax preparation, sales, and many more. The market has been rewarding cloud companies across the board. And yet some cloud companies (like Mongo) are going after far bigger markets than others.   

For instance, Coupa Software (NASDAQ:COUP), a company that provides procurement in the cloud, has given its shareholders a 401% return since 2017. While I love Coupa, I can tell you that procurement ($38 billion) is a much smaller market than database software ($64 billion). "Mongo" is a slang word that actually means "huge" -- and the rise of unstructured data is making this market even larger. Database software is projected to grow from $64 billion today to $98 billion in four years.  Oracle's lack of revenue growth suggests it's not going to see any of that future cash. MongoDB is going to capture a lot of those dollars instead.

The top dog in analytics

Datadog is another SaaS stock that is using the cloud to bring high-end software to anybody who wants it. With Datadog's software, a company can monitor every program it's using, oversee all its applications, and perform log management. Datadog is the first company to combine all three in one solution -- what it calls a "single pane of glass."

Like many cloud companies, Datadog has a "land and expand" strategy. First you get a few subscribers within a company; then, based on word of mouth, multiple people in the company start clamoring for their own subscription, too. Datadog's solution is so popular that existing customers are adding additional subscriptions all the time. The company has an astounding 146% net revenue retention rate. What that means is that in the highly unlikely event that Datadog somehow fails to add any new buyers, the company would still increase its revenue 46% next year just from its existing customers. 

It's true that Datadog is going after a smaller market (analytic software) than MongoDB (database solutions). Datadog estimates its market opportunity at $35 billion. That's a little more than half as big as the opportunity MongoDB is chasing. And yet of the two companies, Datadog currently enjoys a larger market cap -- it's trading at 40 times revenues, while MongoDB's valuation is half that size.

While Datadog's shares are pricey right now, its status as the fastest-growing solution in analytics might justify such a multiple. Consider that Datadog's software currently monitors 10,000,000,000,000 events every day. Let that number sink in for a minute. And then consider that only 5% of applications in the world are currently monitored, according to Gartner.

Have no fear about Datadog, the company -- it's a winner for sure. But the stock might be another story. Comparing the two companies, I'd invest in MongoDB first. After all, the winner in databases will be a far larger company than the winner in analytics. And MongoDB is positively cheap compared to Datadog. The advantage goes to Mongo.