Check out the latest MongoDB earnings call transcript.

One of the best-performing stocks in my portfolio in 2018 was MongoDB (NASDAQ:MDB), the open-source database company. MongoDB went public in October 2017 as a leader in a new, document-based database architecture, poised to take share from legacy database vendors. Increasing adoption of MongoDB has led to blistering growth: last quarter, MongoDB grew an astounding 56.6% as it made further inroads into small and large enterprises.

However, I recently decided to take profits on my MongoDB stake, selling a majority (about 90%) of my shares. Here's why.

Man in business suit holds sign that says Time to Sell.

Image source: Getty Images.

The "Death Star" takes aim

The "Death Star" has reared its head for MongoDB. Not the Death Star from Star Wars, but the company that cable mogul John Malone once compared to that ominous space station: Amazon (NASDAQ:AMZN).

Amazon Web Service's huge cloud infrastructure has allowed the company to expand into databases over time, but its efforts had been limited to the Aurora SQL database and the DynamoDB database. Dynamo is a nonrelational database closer to MongoDB; however, DynamoDB was not open-source, like MongoDB.

I hadn't been as worried over Amazon in the past due to MongoDB's Atlas (database-as-a-service), which grew 300% year over year (not a typo) last quarter. Using Atlas in the cloud benefits not only MongoDB but the underlying cloud providers as well. Since Amazon was the leading infrastructure vendor, Amazon benefited from MongoDB Atlas use.

However, that didn't stop Amazon from directly challenging MongoDB.

DocumentDB revealed

Amazon unveiled DocumentDB, a new database service that takes the MongoDB open-source code and uses an API to essentially reproduce MongoDB. According to the press release from Amazon, "Developers can use the same MongoDB application code, drivers, and tools as they do today to run, manage, and scale workloads on Amazon DocumentDB and enjoy improved performance, scalability, and availability without having to worry about managing the underlying infrastructure."

Amazon highlighted DocumentDB's other advantages over MongoDB:

Customers ... find it challenging to build performant, highly available applications on MongoDB that can quickly scale to multiple Terabytes (TBs) and hundreds of thousands of reads and writes-per-second because of the complexity that comes with setting up and managing MongoDB clusters. As a result, customers spend a lot of time and expense managing MongoDB clusters at scale, including dealing with the undifferentiated heavy lifting of securing, patching, and operating MongoDB. Just like on-premises deployments, managed MongoDB systems face data replication challenges and they suffer from long recovery times in the event of failure.

I don't know how much of an improvement DocumentDB really is over MongoDB in these attributes, but the press release paints a rosy picture.

Open-source benefits and pitfalls

MongoDB is built on open-source software, which means that it contributes code to the open-source community for others to use and improve. Open source has taken off over the past decade, as it helps speed up innovation and agility for the underlying software. The problem is, when you open up your code, others may use it without contributing back to the community.

That led MongoDB to seek a new license in October, introducing the Server Side Public License (SSPL). This new type of license basically says if you use MongoDB's underlying code and deliver it to customers as a service, you have to contribute that delivery application code back to the community.

MongoDB's latest 4.0 software will be covered under the new mandate, so Amazon's new API mimics an older version: MongoDB 3.6, which not covered by SSPL. Amazon will likely add its own 4.0-like features onto DocumentDB in the future, creating a "fork" in the MongoDB database architecture.

Things get testy

In response, MongoDB CEO Dev Ittycheria said in a statement provided to CNBC: "Imitation is the sincerest form of flattery, so it's not surprising that Amazon would try to capitalize on the popularity and momentum of MongoDB. However, developers are savvy enough to distinguish between the real thing and a poor imitation."

Those are certainly some fighting words, and Amazon and MongoDB seem to have moved to the "enemy" side of the term "frenemy" for now.

What I'm doing

Since MongoDB's stock was up more than 200% since its IPO, I sold a majority of my stake, especially since, after the sell-off, the stock still traded at a lofty 17 times sales.

I still kept a (very small) position. The database market is huge, and many enterprises will likely opt for a solution that can travel across multiple clouds to prevent vendor lock-in. For a noncloud document database, MongoDB still appears to be the best out there.

Still, I'm not willing to hold a large position in an expensive stock that just became the target of the Amazon Death Star, and I took some healthy profits for the time being.

Editor's note: This article has been corrected to note that Amazon's new API mimics the older MongoDB 3.6.