Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
donuts236727yNoSQL doesn't really do relational. It's like FB graph. All data is stored in documents.
There will be data duplication. You can do joins but that would be in the app layer: It would query the 2 collections and join and create a new document joining them.
Usually that's not good performance wise for large quieries so when you load the data you basically put everything u ever need about that object into it. -
tahnik387587y@billgates the problems I see is that the code for MySQL is huge compared to Mongo. I have so much code just to deal with simple tables that it is annoying me a lot.
-
donuts236727y@tahnik welcome to my world. I'm not really sure how you are getting it but I guess the first step is creating the collections needed in mongo.
If you can stick with MySQL and don't want to redesign the data models, go with what Josh said.
If you want/need mongo, you can start with splitting and recreating and I guess if performance is a noticable problem then add whatever takes the longest into the FROM collection.
That's sorta what we do...
1.Manual join
2. Optimize queries
3. Preload the data as a child node
Maybe take a look at a mongo DB cookbook.
But really needs to be case by case I think. -
tahnik387587y@JoshBent lol!
@billgates yeah, I moved onto Mongo. My use case probably has a better fit with SQL but it has way too much overhead. And for a one man team, I can't be bothered to maintain it. -
donuts236727y@tahnik overhead == monkey developers that write junk code and think PCs have infinite speed so performance ain't a problem as long as the right result returns eventually?
-
donuts236727y@tahnik will if those 1000 lines can new amortized and save you from writing 10,000 it's not too bad.
-
@tahnik well tbh, I have never reached for an ORM in node, it's just ugly and unreadable imho, especially in comparison with e.g. eloquent in laravel.
-
@tahnik looks almost as ugly to me, just a bit less, also abusing mongodb for anything else but its purpose, will end up in a lot of unmaintainable and self destructive chaos (especially with all hacks, to make it somewhat behave like mysql)
not to mention if you do want to scale at some point, how much pain comes with it, versus maintaining mysql
Just an interesting read on topic:
http://cryto.net/~joepie91/blog/... -
tahnik387587y@JoshBent I have read those blogs and more. Most of them are outdated. MongoDB recently passed the Jepsen test: https://mongodb.com/mongodb-3.4-pas....
So I don't think it's as bad as it used to be.
And as for the DB design, you generally don't design NoSQL to behave like SQL. It has it's own design pattern. The docs of firebase is quite helpful to learn those. -
@tahnik I would really hope they improved since, though I still hear horror stories about it, so I rather pass on using it in production, especially any bigger scale than a hobby project.
Also you did make it sound, like you would want to make mongodb (dbms) work like mysql (rdbms), which still, will imho result in unmaintainable mess. -
tahnik387587y@JoshBent I am trying to follow the design guidelines of NoSQL. Hopefully it won't be a mess.
-
tahnik387587y@marcorodnav lol
@inaba @hashedram the problem for me is the amount of code to maintain for SQL. There is too many layers of validation for simple stuff. For example, with MySQL, I need migrations for the tables, then I need models for each table, I need controllers as well.
With Mongo, I can just have models with proper validation rules and it's perfect as long as the design is done correctly. What's even better is because I am using GraphQL, I can just fetch data directly from Mongo and pass it to the GraphQL, which automatically filters out unnecessary data.
Related Rants
Has anyone here used MongoDB for relational databases? I am trying to use MySQL with Node but I feel like the whole thing is a mess. There are some ORMs like Knex or Sequelize for MySQL but they are pretty crap. I am thinking if I should just move onto MongoDB instead of MySQL, at the same time I feel a little dirty to store relational data in a document store :(
question
mysql
mongo