Close but no cigar. That's the story for the Nasdaq Composite Index early last month. The index came within 0.5% of rising 20% above its low point set on Dec. 28. That technically would have been bull market territory. But it didn't happen.

Investors shouldn't give up, though. A Nasdaq bull market is still in sight. Here are three top stocks to buy before it comes.

1. Amazon

Amazon (AMZN -2.56%) stock is already in a bull market of its own. Shares of the e-commerce and cloud services giant have soared a little over 20% since bottoming out in late December 2022. Most of the gain was made this year.

The best news for Amazon over the near term is that its profitability should improve significantly. Amazon has taken steps to reduce spending. Those efforts should show up on the company's bottom line in the coming quarters. Once the economic outlook is less murky, Amazon's revenue should also return to strong growth.

Over the long term, the story looks even better. Amazon Web Services (AWS) could deliver explosive growth with the emergence of new artificial intelligence (AI) systems. That's in addition to the existing tailwind resulting from organizations migrating their apps and data to the cloud.

There are several other growth drivers, too. Amazon claims the fastest-growing digital ad business. The company has expanded further into healthcare with the recent acquisition of One Medical. It's also hoping to become an even bigger player in smart home technology.

2. MongoDB

Shares of MongoDB (MDB -2.41%) have soared nearly 30% above the low hit on Oct. 14. However, the database platform stock remains over 60% below its peak in late 2021.

MongoDB's business has certainly slowed as customers reduced their workloads. But the company has seen some bright spots even with the slowing growth. Revenue jumped 36% year over year in the fourth quarter of 2022. MongoDB CEO Dev Ittycheria also noted in the Q4 call that the company has been able to win new business even with the challenging macro environment. 

IDC projects that the data management software market will increase from $85 billion in 2022 to $138 billion in 2026. The market will almost certainly continue its strong growth trajectory for a long time after that period. There's no question that increasingly more data will be generated and need to be stored somewhere.

MongoDB's cloud-based platform should grow even faster than the overall market for two main reasons. First, it enables customers to reduce the complexity involved with building and managing database apps. Second, it reduces their costs. That's a combination that should make this stock a huge winner over the long run.

3. The Trade Desk

The Trade Desk (TTD -4.34%) stock fell as much as 64% below its previous high late last year. Since then, its shares have skyrocketed close to 60%. Although the momentum has cooled somewhat over the past couple of months, The Trade Desk should have plenty of room to run. 

Many advertising technology (adtech) companies have experienced a slump as advertisers scaled back on their spending. That hasn't been true for The Trade Desk, though. Spending on its platform reached a record high in the fourth quarter of 2022. 

One key reason why The Trade Desk continues to perform so well is an underlying shift in the digital advertising market. Advertisers are prioritizing ad placement on connected TV (CTV) more instead of on sites that feature user-generated online content.

It also helps that The Trade Desk's platform offers better functionality than competitors. The company's Unified ID Solution 2.0 (UID2) provides a way for advertisers to analyze consumer data without using cookies. The Trade Desk expects that close to 75% of the third-party data ecosystem will use UID2 later this year compared to around 15% in Q4 of 2022.

This stock is expensive. However, with The Trade Desk's fantastic growth prospects, it deserves a premium price tag.