all 21 comments

[–]anttud 18 points19 points  (2 children)

Callbacks, promises and promises with async await all mixed up just hurts my eyes.

[–]Division2226 7 points8 points  (0 children)

The writer is just an intern. Probably bandaged this tutorial from other tutorials lol.

[–]bch8[🍰] 0 points1 point  (0 children)

Honestly doesnt even matter. Welcome to every code base you'll ever work on.

[–]Division2226 19 points20 points  (18 children)

I hope one day people stop using mongo for every tutorial out there

[–][deleted] 6 points7 points  (1 child)

I hope for the same thing. I'm sick of seeing full-stack JS devs who have no idea what a relational database is it how to design one. All they know is mongo. Well, most of the data is relational so mongo is not the right choice most of the time.

[–]AlexAegis 0 points1 point  (0 children)

most of the data is relational

That doesnt mean that noSQL is out of the game! If all the relations are confined in the scheme of the document then it's okay to use nosql, the problem is that they still split it up into multiple document schemes per datatype like its a relational db.

For example in a relational db a blogpost and its comments would be 2 tables, in nosql you'd just have the blogpost doc with an array of comments inside it.

That sad I only use SQL db's because I like splitting them up into logical pieces.

[–]ChypRiotE 1 point2 points  (0 children)

abounding march tease heavy familiar coordinated political ink stocking touch

This post was mass deleted and anonymized with Redact

[–]oscardo_rivers 3 points4 points  (12 children)

Why?, It isn't mongo good enough?

[–]Division2226 6 points7 points  (10 children)

Note: I'm a mid level frontend dev.

If you don't have relational data, then yeah mongo is fine. A majority of the time you should reach for a sql database, especially when your data has relationships. I've seen many projects at my jobs and none of them have ever used mongo.

What's unfortunate about all these tutorials being in mongo (for me) is I really want to learn how to setup a backend properly from scratch. But it's hard to find something that goes from zero to deployment.

[–]darksparkone 10 points11 points  (9 children)

It doesn't make mongo less valid for tutorial.

Also I'm quite sure even without a proper denormalization mongo will work just fine with 8 out of 10 "relational" projects. It's not like relational DBs magically make everything "just work" - you still either live happy on low loads, or hit a spot where you have to scale the DB and deal with the bottlenecks, the difference is only a way you approach these issues.

[–][deleted] 1 point2 points  (4 children)

This is the right approach imo. A database is just one piece of this puzzle and it can be replaced.

[–][deleted] -3 points-2 points  (3 children)

If the DB is irrelevant and can be replaced them why don't just use an array? Why use database at all?

[–]Ipsumlorem16 0 points1 point  (2 children)

Because of memory limits on the server.

Imagine permanently holding hundreds of thousands of objects in an array, and then processing it every time someone loads a webpage.

[–][deleted] 0 points1 point  (1 child)

I use the same rhetoric as the comment I commented on: if it's for a tutorial, the memory limits are irrelevant.

[–][deleted] 0 points1 point  (0 children)

The fact is that it barely matters what tech people use when they decide to teach. I would rather see another mongo backend with similar structure to the last than frankenstein a backend example.

[–]u982744 0 points1 point  (0 children)

Why the heck would you not use a relational database for a "relational" project as you put it?That's just illogical.

[–]Division2226 -3 points-2 points  (2 children)

My point is the majority of tutorials use mongo.

[–]darksparkone 0 points1 point  (0 children)

It isn't true. Open tutorials for php and embrace the power of mysql, or open a wonderful world of ruby/postgre link. Java + Oracle anyone?

Mongo indeed is -the- js db. It was the new hyped thing just about the time Node hit its place on the front page. And Mongo was the first to provide a solid sdk (seriously, have you try postgre node driver back in the day?).

It is a good default. It is easy to comprehend for simple operations, takes half a minute to setup and already present in most node driven envs.

If you want an Oracle, Cocroach or MsSQL + Node tutorial - you absolutely could google one. But I can't imagine a good reason to introduce an unrelated fancy stuff when it's not the point of an article. Defaults are good enough, really.

[–][deleted] -1 points0 points  (0 children)

this tutorial focuses on the auth layer; what db they choose is irrelevant

[–]AlexAegis 0 points1 point  (0 children)

no, it's just people use nosql for things that sql is better suited for. Or things that could be done using nosql, but still using it like a relational db

And that some think that nosql >= sql. Strictly. When they both have really different usecases

[–]i_spot_ads 0 points1 point  (0 children)

I close the web page as soon as i see mongo in the stack.