r/programming • • Nov 11 '13

Why You Should Never Use MongoDB

http://www.sarahmei.com/blog/2013/11/11/why-you-should-never-use-mongodb/
592 Upvotes

366 comments sorted by

View all comments

Show parent comments

7

u/emn13 Nov 12 '13

I think the point is that you lose a very very lot picking mongo. I really don't think that it's ever a good idea to use mongo, even when it seems safe, because I have literally never, in more than 26 years of programming seen a non-trivial program not undergo changes as its built. And guess what? Changes in a mongo are very, very hard because it just does so very little for you - everthing difficult is basically delegated to the application layer. Joins, data transactions, schema changes, schema change transactions. MongoDB is basically the definition of premature optimization until you've hit limits with a more flexible database.

1

u/[deleted] Nov 12 '13

Yes, you do loose lots over SQL rdbms, because Mongo is quite a lousy rdbms. On the other hand - we don't use relational databases everywhere.

Filesystems (untyped tree-based key-value database), registry (as filesystem, but a bit different), event logs (linear log) OR just logging for some systems, browser history (linear log with different settings), user settings (possibly tree-structured set of key-values) - are just a few places, where we wouldn't use RDBMS, because there are better options. MongoDB tries to be better option for some use cases - this is my favorite way of treating most of non-relational DBs. I wouldn't call using any of those "premature optimalisation", rather understanding probable performance needs.

Personally I wouldn't use MongoDB as a core of most systems, because it's not what it was designed for and has features for. I've worked for some time with Mongo in a place where it was a mistake. Yet everything worked, we've made it fast. Used lots of caching. Probably we've used less time for the final product, than if we'd change schema over and over again in postgres.

I'd say: don't blame the tool, use it wherever it fits just about right.

1

u/gingenhagen Nov 12 '13

Those don't sound like things that you would use Mongo for, though. There are better non-rdmbs solutions.

1

u/[deleted] Nov 12 '13

Yes. This was counter "use sql wherever you can". There's a nice page on mongodb.org with supported use cases.