People like to joke about MongoDB, but this is actually a good use case for a sharded noSQL database like MongoDB. Due to the consistency model of most SQL databases it can be hard to get enough write throughput to satisfy the requirements for a website with lots of users.
That entire article is about how MongoDB didn’t work well with that developers very specific and predefined data structure, and many of his complaints appear to be about things that are inherent to every NoSQL dB not just Mongo.
MongoDB is a perfectly fine database. It’s true it does have scaling issues if you’re dealing with massive data sets, but for most people it’s tooling alone makes it worthwhile.
I worked with mongo for a couple years at my last gig and recently started a new one where we're on sql. I'm having trouble going back - feel like I stepped back in time
For many people, Mongo is the main (sometimes only) NoSQL database they'll ever use. Yes, it's an object-based scheme problem in general, not just Mongo - you can substitute it in your mind when reading if you want. And no, it's not a NoSQL problem, since NoSQL also includes stuff like GraphDB, and many other schemas that just aren't standard SQL.
I'm not claiming MongoDB is the right DB for everyone and every problem. But it is a perfectly good to DB for both people new to to NoSQL, and projects that don't have overly complex data architectures and don't have to worry about scaling to support a Facebook amount of concurrent users.
My stack for my current startup utilizes a mixture of MongoDB and Redis for its primary user storage and it's proven extremely efficient. This whole "MongoDB is bad" joke is stupid and misleading.
Thanks for the read. I was feeing kind of bad that I have been shoving lots of loose-schema’d JSON into columns in my MSSQL server. Still feels wrong, but I feel affirmed that Mongo would be wronger for my case.
That article is garbage. MongoDB is perfectly adequate for the vast majority of users. If you don’t want to use Mongo go with another NoSQL database, but please stop storing stringified JSON data in your SQL columns.
Don't listen to that other guy, you are correct (as much as once can be correct in a partly subjective matter). Like the other guy said, Mongo is adequate for storing object-like data, but you'd need both SQL and Mongo (or other object-based* DB) if you have both types of data, and having 2 databases is very rarely worth the performance (well, unless you count something like Redis as a NoSQL DB, even though it's just a simply object-based* cache).
I don't know his usage case, but generally speaking if you hear someone is storing stringified JSON data in SQL, theres a good chance they're doing something wrong.
If he's just storing small blobs of data to pass directly onto the client that's fine (though he should probably be encoding it first).
But if he's using it to represent a parent-child relationship, he needs to move that data out into a separate table and join on it instead, as storing data in JSON blobs takes up a lot more space and won't allow you to index on, or partially select any of the subfields.
If he doesn't want to put the data in a separate table as it doesn't have a strongly defined schema attached to it, then SQL probably isn't the right solution altogether.
As you say, Redis can be a good second option in the cases where you want to combine both object based and relational based storage formats. Even if it requires multiple queries, it'll still likely be faster than having SQL read large amounts of JSON off of disk.
But.. you do realize not all data that has a parent child relationship needs to be indexed, nor operated on in any way other than being displayed as additional data when a SINGLE object is queried?
Of course, parent-child relations are generally one-to-many tables, but very often a single row will have a lot of not-that-important data which only needs to be displayed when that object is queried directly, and never searched by (example - non-technical description of products).
Sure, indexed data deserves its own columns (and sometimes tables), but we were talking about data that could be placed either into MongoDB or a JSON string - relation data was never in this question to begin with.
And sure - JSON strings "waste" space, while blobs "waste" performance with encoding/decoding - however, if you're storing data in a JSON string/blob that's important enough for the space or lost performance to matter, you should've stored it in its own column/table to begin with.
Discord doesn’t use mongo, but their database architecture is very similar to what you describe, and they call out the same design considerations in this article
109
u/nishinoran Mar 26 '20 edited Mar 26 '20
Mongo DB is web scale, it has sharding.
I hear piping data to /dev/null might scale even better though