News for hackers. Stuff that matters.
Re:Why you should never use MongoDB (2013) by manyxcxi on Monday August 15, 2016 @11:39AM (#12291153)
This is a problem I've had to explain to too many developers recently. It's not faster just because you throw away data modeling practices and jam bits of info all over the place.

If you have semi normalized data relationships, Mongo really doesn't fit the bill that well as your primary data store.

Where it shines is when you've got computed pieces of data to display (parts of a user data feed for example, data for a live graph, etc), you want to quickly store some data to be processed later (analytics, event processing), or you just use it as an object cache for expensive queries.

I have found that with a decently tuned DB, and I mean barely tuned, a decent data model, and sane fetching strategies (don't eager load everything always), a database can be good enough for quite a while, if not forever.

The answer I pretty much always get from people when I ask, "Why did you start with (whatever NoSQL they chose)?" Is, "Because (whoever) said it's faster and scales better."

I think younger devs that have options besides relational DBs find the barriers to entry on NoSQL lower (it looks mostly like how it went in and it's just JSON) so they pass over the learning SQL and basic data normalization fundamentals.

Re:Why you should never use MongoDB (2013) by catnaroek on Monday August 15, 2016 @01:13PM (#12291773)
> find the barriers to entry on NoSQL lower

Not having to think rigorously about the logical structure of your data is a huge selling point for many. For programmers, because it means they don't have to think. And for employers, because it means they can make do with programmers who don't want to think.

Re:Why you should never use MongoDB (2013) by sangnoir on Monday August 15, 2016 @05:09PM (#12293478)
> Not having to think rigorously about the logical structure of your data is a huge selling point for many

I'll play the devils advocate: what ever logical structure of the data you come up with will not line-up with relational DB tables - I have had the pleasure of designing relational schemas for cyclic graphs. Hell, we have been trying and failing to do Object-Relational Mapping for years now, and it's still a shit-show. I could name a long list of ORM libraries and an even longer list of their various deficiencies.

Say you've thought rigorously about the logical structure of your data and v1 is out, and now a change comes along and you need an extra field or 5. Renormalize your structure, write some migration scripts (in both directions, just in case you want to downgrade). With NoSQL I'll just dump the new document structure and call it a day (or rather, deal wiht the differences in the application layer).

Re:Why you should never use MongoDB (2013) by catnaroek on Monday August 15, 2016 @05:29PM (#12293610)
I suspect you read too much into my comment. I wasn't making a value judgment. If anything, I'm actually in favor of thinking no more than necessary to get high-quality results - but also no less than that.

> I'll play the devils advocate: what ever logical structure of the data you come up with will not line-up with relational DB tables

That contradicts my experience. The relational model isn't a panacea, but it lets me model most scenarios adequately. Whenever the relational model is deficient, what I want is more powerful schemas (sum and product tables, constraints spanning several tables, etc.), not less.

> Hell, we have been trying and failing to do Object-Relational Mapping for years now, and it's still a shit-show.

I'm inclined to think the problem is actually at the object-oriented end of the bridge: https://news.ycombinator.com/item?id=11861520

> With NoSQL I'll just dump the new document structure and call it a day (or rather, deal with the differences in the application layer).

Correctly managing these differences without help from schema-aware tools is rather painful.

Re:Why you should never use MongoDB (2013) by 20years on Monday August 15, 2016 @01:22PM (#12291838)
That is a scary thought.
Re:Why you should never use MongoDB (2013) by catnaroek on Monday August 15, 2016 @05:44PM (#12293716)
It isn't that scary once you take into account the fact that our brains are just as finite as any other resource available to us. It's a virtue not to make more mental effort than what is strictly necessary to complete the task at hand.
Re:Why you should never use MongoDB (2013) by 20years on Monday August 15, 2016 @05:49PM (#12293755)
I agree with "It's a virtue not to make more mental effort than what is strictly necessary." but to have an environment with only "programmers who don't want to think" is not appealing at all to me. I personally want to be surrounding by thinkers.
Re:Why you should never use MongoDB (2013) by pbreit on Monday August 15, 2016 @04:39PM (#12293235)
Only scary if you are locked into the past and/or closed-minded. (disclaimer: I'm not a mongo fan).
Re:Why you should never use MongoDB (2013) by 20years on Monday August 15, 2016 @05:42PM (#12293703)
I was mainly referring to "And for employers, because it means they can make do with programmers who don't want to think."

Sorry, but I don't want to work in an environment where programmers don't want to think or don't have to think. That is a scary thought. Has nothing to do with being locked into the past or being closed-minded. Just the opposite actually.

Re:Why you should never use MongoDB (2013) by emp_zealoth on Monday August 15, 2016 @06:40PM (#12294044)
How else do you think we arrived at webpages that need hundreds of MB of RAM?
Re:Why you should never use MongoDB (2013) by jt2190 on Monday August 15, 2016 @12:41PM (#12291557)
I agree with you, but would like to add that by using SQL to query a relational database it is very, very easy to denormalize the data that is copied into an application, so while a relational schema is essentially "static", query results are very dynamic, and can easily strip away all of the "goodness" that results from a normalized data structure.

In other words, the application probably needs to deal with normalization and schema if it's taking copies of data, and using a relational database doesn't remove this requirement. (Of course, small applications often get away without enforcing schema, with the understanding that frequent database write failures due to malformed data are ok.)

Re:Why you should never use MongoDB (2013) by DashRattlesnake on Monday August 15, 2016 @05:36PM (#12293665)
> The answer I pretty much always get from people when I ask, "Why did you start with (whatever NoSQL they chose)?" Is, "Because (whoever) said it's faster and scales better."

Pretty much the classic http://www.mongodb-is-web-scale.com/?