Live data from Hacker News

Why you should never use MongoDB (2013)

sarahmei.com

21–30 of 188 posts

Re: Why you should never use MongoDB (2013)

#21
post #5

I stopped reading where it said "never".

I'm usually against absolutes, but I'm really in agreement here. It's almost always better to use a relational database, and in the rare cases where you wouldn't want a relational database, MongoDB is the worst of the major options. It literally memory leaks and drops data without warning or provocation. If you're not going to go with a relational database, RethinkDB, Cassandra, Redis, or BerkeleyDB would all be better choices (which one depends on situation).

Re: Why you should never use MongoDB (2013)

#23
post #6

This is from 2013 - honest question from someone that doesn't know, is it still relevant?

If you read the post, the problem wasn't Mongo as much as they chose the new hotness (document db/graph model) when in reality their problem was already well solved by a RDBMS and tabular model, they had classic problems like duplicate data and performance issues when they tried to use a document db as a RDBMS. They changed over and everything was fine.

OK, I read it, and that was my reaction as well, but I wasn't sure if it was due to my lack of Mongo knowledge or not. Apparently I understood it! :)

I always struggle with when not to use an RDBMS, because I work with Teradata at the office and so far it hasn't let me down and there's been little pressure to find something new. And my industry (insurance) does not do new for the sake of new.

Re: Why you should never use MongoDB (2013)

#24

I think it's ironic that the page says "Error establishing a database connection". As someone who used MongoDB extensively in the past (8TB+ of data) and also managed the devops side of things, I can tell you straight out that MongoDB has a place in a lot of startup stacks. I would likely not use it as a main source of truth for any application. However for a lot of things, it's a good database. Since I can't read th…

> I would likely not use it as a main source of truth for any application but for a lot of things, it's a good database.

I really don't understand this. In what case is it every acceptable for a data store to lose data? And that's not even MongoDB's only problem: it memory leaks!

Re: Why you should never use MongoDB (2013)

#25

I think it's ironic that the page says "Error establishing a database connection". As someone who used MongoDB extensively in the past (8TB+ of data) and also managed the devops side of things, I can tell you straight out that MongoDB has a place in a lot of startup stacks. I would likely not use it as a main source of truth for any application. However for a lot of things, it's a good database. Since I can't read th…

> I would likely not use it as a main source of truth for any application

what the point then ? MongoDB isn't even good for analytics and big data. What do you store in MongoDB ?

Re: Why you should never use MongoDB (2013)

#26

I think it's ironic that the page says "Error establishing a database connection". As someone who used MongoDB extensively in the past (8TB+ of data) and also managed the devops side of things, I can tell you straight out that MongoDB has a place in a lot of startup stacks. I would likely not use it as a main source of truth for any application. However for a lot of things, it's a good database. Since I can't read th…

The placement of the commas in your post is blowing my mind!

Re: Why you should never use MongoDB (2013)

#27
My first introduction to databases was with PHP/MySQL, where normalization was the name of the game. The whole point of normalization is that there is no duplication of data anywhere. If it's possible for duplicate data to exist, that's a symptom of a design flaw in the schema.

I've been using Mongo recently, and every time I raise criticism of it, the counterargument I hear is "forget about normalization! Duplication is okay."

Like the author, I really cannot wrap my head around this. While I understand that duplicating documents across collections may make querying faster, what about when you want to change the document? You need to propagate the change across every duplicate of the document in every collection where it exists. This means that any "de-duplication" logic needs to happen at the application level, rather than the database level.

Parse.com provided an interesting abstraction around that with "cloud code" and beforeSave and afterSave triggers. To maintain consistency, they encourage propagating updates to a document within its collection's beforeSave function. So if a document changes in one collection, you write code to change all instances of the document in other collections. That's nice in that it almost feels like you're writing the dedeuplication logic in the database layer, because you can view the "beforeSave" and "afterSave" functions as extensions of the schema. As long as those functions are up to date, the schema and any pseudo-linked documents will stay up to date.

But I really don't buy it. The strengths of mongo encourage a design that necessitates complexity for any significant write operation.

I think the real issue is that "if you have a hammer, everything looks like a nail." Mongo and other NoSQL stores have some real use cases, but people who are more familiar with Mongo than RDBMS are too trigger happy to employ it as a solution to problems where a RDBMS is the clear solution.

Re: Why you should never use MongoDB (2013)

#28
An interesting article. I'm always wary with no approaches in technology due to the "trendy" factor that often pushes for the novel for no reason other than its novelty. That said, I am curious if there are use cases where non-relational databases like MongoDB make sense as data caches for quick read only access, since the data could be formatted in the way that API calls would already expect it to be post extraction.

Re: Why you should never use MongoDB (2013)

#29
It takes that article a long time to get to the point. What I'd like to know is, "why is emulating joins bad?"

Specifically, why is it bad to load a MongoDB document, and then load downstream documents that it links to? What kind of problems does this lead to?

Granted, when I worked with MongoDB, I encountered problems due to its lack of transactions. (It's surprisingly unreliable if you end up needing to update multiple documents; when a relational database can do that easily in a transaction.)

But, assuming you can pick an application design that does single-document updates; why is following links in a document bad?

Post reply on HN