Over a million developers have joined DZone.

You Definitely Shouldn't Use MongoDB

DZone's Guide to

You Definitely Shouldn't Use MongoDB

· Java Zone
Free Resource

Learn how our document data model can map directly to how you program your app, and native database features like secondary indexes, geospatial and text search give you full access to your data. Brought to you in partnership with MongoDB.

You may be curious: "Why not, exactly?" Answering that question is the central idea of Sarah Mei's recent blog post titled "Why You Should Never Use MongoDB."

Her use of the word "never" seems like a bit of an exaggeration, but she makes a compelling argument against the open-source document database - or at least the one-size-fits-all attitude some take with it - through the in-depth story of Diaspora, a social network to which she contributed a few years ago.

The central issue for Diaspora, according to Mei, was inflexibility brought on by the document structure of MongoDB. Reorganizing data after the fact - for instance, keeping track of user data as it relates to other user's pages, and posts, and anywhere else it might appear throughout the site - became cumbersome as references duplicated themselves, detached from each other and as different types, on various pages throughout the database. 

According to Mei, MongoDB is for data that can be organized into documents, and those documents should be discrete units. If the links between documents are central to the structure you are creating, Mei says, you shouldn't be using MongoDB.

So, while Mei says that you should never use MongoDB, I think she means that you should not assume MongoDB is what you need, and you should not start with MongoDB by default. Instead, you should adequately plan for your needs, and more importantly, plan for the possibility that your needs may change. 

Also, don't build social networks on MongoDB. I think she really means "never" there.

Discover when your data grows or your application performance demands increase, MongoDB Atlas allows you to scale out your deployment with an automated sharding process that ensures zero application downtime. Brought to you in partnership with MongoDB.


Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}