The stock market's generally dismissive mood doesn't seem likely to improve as we get ready to close 2022, particularly when it comes to tech stocks.

That may be disappointing to those focused on the short term and hoping for a "Santa Claus" rally, but for patient investors looking to build wealth over the long run, now would be an opportune time to open positions in high-quality businesses. Two such businesses worth taking a closer look at are DigitalOcean (DOCN 3.15%) and MongoDB (MDB -3.97%)

DigitalOcean: Relatively small in size, yet mature in its outlook

DigitalOcean provides low-cost cloud hosting services for small and medium-sized businesses. It's simplifying the adoption of the cloud, a key building block of the digital economy, so that its clients can focus on their products and services rather than worrying about tech infrastructure.

The company is still a recent arrival in the public markets, but you likely wouldn't guess it was so young from looking at its execution.

Despite a tough macro environment, DigitalOcean reported excellent third-quarter results. Revenue grew 37% year over year, and annual recurring revenue -- an indicator of the stability of the company's cash flow -- increased 41%. The number of customers spending over $50 a month on DigitalOcean's services jumped by 50% to 142,000, and its average revenue per user grew by 28%.

Unlike many early-stage growth companies, DigitalOcean has been free-cash-flow positive. Its free-cash-flow margin in 2021 was 6%, and management expects that will grow to 11% for full-year 2022. It estimates its revenue will be less than $600 million this year.

DigitalOcean IT technician working in data center.

Image source: Getty Images.

For a relatively small company that serves the types of customers that are typically more vulnerable to trouble during economic downturns, DigitalOcean's 2022 performance has been incredibly resilient. And that's not a coincidence. It has developed a diverse client base across 165 countries and multiple industry verticals. That diversification limits its downside.

Additionally, DigitalOcean has mastered the low-cost service delivery model. It powers critical services for its customers for low prices, creating a compelling return on their investments. Finally, its usage-based model allows customers to throttle their expenses if they choose to, making it a value-based and customer-centric service.

DigitalOcean's recent acquisition of Cloudways makes it an even stronger business. The acquisition augmented the company's do-it-yourself cloud-based hosting model with Cloudways' managed services approach, allowing it to address a broader customer base and positioning it better to capture more of its $72 billion market opportunity -- an opportunity it projects will grow to $145 billion in 2025.

CEO Yancey Spruill is focused on growing the company in a responsible manner and describes himself as "obsessed about free cash flow."

DigitalOcean has set the goal of growing its sales at 30% annually over the long run while producing higher free-cash-flow margins. With its smart execution, I think the company is in a great position to hit those targets.

DigitalOcean's shares are down more than 70% from the all-time high posted about a year ago, and its current price-to-sales ratio of about 5.7 offers an attractive entry point for long-term investors.

MongoDB: Future opportunity looks promising

Almost every company today is in some sense a tech and software company, and at the heart of each working software app is a database like MongoDB. It is the glue that holds various software systems together and plays a key role in fulfilling business services. 

MongoDB's design is founded on a relatively new paradigm: the NoSQL database. This allows developers greater flexibility, enables faster development, and lowers the overall cost of development.

MongoDB is also cloud agnostic -- customers can set it up on any of the major cloud platforms. Its design also allows customers to scale their operations quickly without compromising on performance. In addition, the company offers a cloud-based full-service offering with its Atlas product, allowing its clients to rely on MongoDB for their database needs.

MongoDB is not the only game in town for NoSQL databases, but it is a top choice for businesses, and the company's fiscal 2023 third-quarter results, reported about a week ago, underscored that one more time.

In the quarter, which ended Oct. 31, MongoDB added 2,100 net new customers, bringing its total to 39,100. The number of customers responsible for more than $100,000 in annual recurring revenue grew from 1,201 a year ago to 1,545. Total revenue jumped 47% to $333.6 million, and revenue from Atlas spiked 61%. Atlas is now responsible for 63% of total revenue.

The company continues to invest heavily in gaining market share and is not profitable. But its net loss margin improved notably from 35.8% a year ago to 25.4% in the recently reported quarter.

Macro headwinds over the next few months may lead to slower growth for the company and high volatility in its stock price, but it's clear that MongoDB offers an essential service, it's a top choice in the NoSQL DB market, and it's executing well. Shares are down by about 64% from the all-time high reached a year ago, and are trading close to the all-time low on a price-to-sales basis at a ratio of around 11.6.

With a massive potential market opportunity of $84 billion, MongoDB has a long runway in front of it. Taking a small position in MongoDB will likely make investors happy in the long run.