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

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.


Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}