343 karma · joined June 4, 2010
A decent example is a person record with their email addresses and phones. In a relational DB, you would always and only model those as three sepearate tables, and you would quite frequently need a three way join to assemble that person again.
In MongoDB, you would definitely have an array of emails and an array of phone numbers embedded in that person document, sparing the join on those queries. But in an ecommerce context, you would likely not embed an array of all past orders with all the line items into that person, instead you’d have an array of previous order numbers.
But an order document would have an embedded array of line items, sparing the DB a bunch more joins (and the attendant indices you’d need for joining line items to orders efficiently).
Getting the 10 most recent orders from a customer would involve joining the customers collection with the orders collection (MongoDB’s join is the `$lookup` aggregation stage), but it wouldn’t involve joining the line items to the order.
Is that replicating a relational structure? A little column A, a little column B.
I think you are referring to the 100MB RAM limit, but that’s not a hard limit, it’s more of a bad default. The `allowDiskUse` option lets MongoDB write intermediate results to the disk (which is exactly what SQL databases are doing).
> But aggregate queries really do not give you the power of SQL. They are great for transforming stuff for a report, but I would avoid using them for anything else unless 1) it can be cached (and therefor properly invalidated) and 2) doesn't need to be "real time"
I really don’t see a difference between what you can do with MongoDB and SQL. I can’t say much more without knowing specifically what impediments you have in mind, but I would certainly like to hear more. For example, why do you cite results caching and lack of real-time requirements?
> Being a document, schema-less database,
I guess if you’re on 3.4 you can’t take advantage of JSON Schema yet, but keep that in mind as a part of your upgrade plans. In the meanwhile you can still use document validation?
> your "quality of life" as you scale with MongoDB is going to be heavily dependent on how you structure your documents and the types of their fields.
This is completely true, but couldn’t we say that just as much about any database? I’d put money on there being way more grief out there over bad tabular schema than over bad document schema. I mean, who’s worked on large-scale systems that hasn’t put off implementing great ideas, or had to hack up app code to compensate for a restrictive schema, because you can’t take the pain of ALTER TABLE?
> Are you treating your collections like SQL tables?
Ouch. Please don't!
> Have any many-to-many relationships in hot code paths? Welcome to hell.
That's probably fair, but if you're in hell to a vastly greater than you would be with Postgres, I'm pretty sure that's a modeling problem. Again, can you tell me more about the particular example?
> Its type system is also limited compared to modern SQL DBs. Storing IP addresses, and want to query them based on a given CIDR range? Postgres makes this eas, MongoDB has you writing code that does sub-queries
That's 100% legit. MongoDB needs to do a ton better with that... types rule.
If you have a “one-to-many(some)” kind of relationship, embedding is a good option, and gets you ACID semantics without even resorting to multi-statement transactions.
If you have a “one-to-many(thousands or more)” kind of relationship, objectID references (a la foreign key) is more likely what you want.
Perhaps you are unaware, but that is a straw-man. That’s not how you’re supposed to with MongoDB. You’d use the aggregation framework:
db.sales.aggregate( [ { $group : { _id : null, totalPrice: { $sum: { $multiply: [ "$price", "$quantity" ] } }, averageQuantity: { $avg: "$quantity" }, count: { $sum: 1 } } } ] )
https://docs.mongodb.com/manual/reference/operator/aggregati...
https://docs.mongodb.com/manual/reference/operator/aggregati...
This has been the case since MongoDB 2.0, in 2012.
Nonetheless, it’s accurate enough to say that the 1.0 BI connector used Postgres code. It was definitely the fastest way to deliver it.
2.x was built from scratch, it uses no Postgres whatsoever.
But your main point is good—- JSON isn’t the essence of it.
And yet it’s part of it, in that you could store XML and still be a document DB; MongoDB definitely chose JSON as the medium deliberately.
You would be correct, as the mountain of ignorance about MongoDB on display in this and all HN threads on MongoDB attest to.
What do you mean?
Twitter has some great aspects. It's really lightweight and doesn't enforce mutuality, making it possible to form communities on events on topics, or to learn in realtime what's going on somewhere. But as a product it is complete and utter garbage.
And twitter can't improve, because it's hardcore base is super convinced that its critical flaws are features.
Not exactly, but we published a blog post about why we took the time to write a new CI system, and that post does touch upon why we didn't use Jenkins + plugins.
https://engineering.mongodb.com/post/evergreen-continuous-in...
I like it.
I still don't see the outcome you predict.
TLDR; power consolidation is a risk factor that leads to actual bad policy, not something with actual, palpable negative value in and of itself. E.g. the power of the federal government to end slavery is a win in my book.
* * * *
Let's map "objectionability" onto a number line.
A neutral policy is zero. An objectionable one is on the negative side, a non-objectionable one is on the positive side. The magnitude of the objectionability or virtue yields the magnitude of the number.
I'll go with your presumption that both Clinton and Trump's policies are only found on the negative side of that line. And we'll deal with their policies in aggregate. We'll also assume that current policy is perfectly neutral, at zero:
<---------T-------------C-----0
T = Trump APV (avg policy value)
C = Clinton APV
0 = CPV (current policy value)
Let's map effectiveness to a float between 0 and 1. Simple. If Trump's policies are twice as bad as Clinton's, he has to be half as effective as she for them to equal out. Here's a little table:
APV, Effect, Total value, Who, Worse
-20, .05, -1, Trump, O
-2, .95, -1.9, Clinton, X
-20, .1, -2, Trump, X
-2, .9, -1.8, Clinton, O
-10, .05, -0.5, Trump, O
-2, .95, -1.9, Clinton, X
-10, .2, -2, Trump, X
-2, .8, -1.6, Clinton, O
The problem with that simplification is the assumption that CPV is at neutral, zero. And mapping effectiveness to a scalar factor of APV is also incorrect -- instead, it has to be understood as a normalization factor, attempting to return CPV to APV. The greater the effectiveness, the more quickly CPV achieves APV.
Should any factor bring CPV further negative than Clinton's APV, her effectiveness would become a force that lifts CPV. Meanwhile, Trump's is always attempting to pull CPV further negative towards his abysmal APV.
> You have no idea how he got to his position
False. I cannot prove how. The objection is pure sophistry. Were I to ask him, "how did you arrive at this position", his answer could be a lie. Would you commit the fundamental attribution error and assume that he would tell the truth? Perhaps he secretly doesn't even believe what he claimed to believe!
I doubt very much that you live your life doubting all things beyond your own thoughts. Trotting out a single fallacy mode and applying it in a scope carefully limited to bolster your argument is a rhetorical method for scoring debate points, not sound logic.
You are attempting to use "intellectual honesty" as a cudgel. Who wouldn't want to be intellectually honest?! Of course, you'll be the judge of when someone has met the criteria for honesty, and that will depend on whether they agree with you or not.
I am under no misunderstanding as to what I can and cannot know. I am completely comfortable with using mental shorthand to navigate the world. I do not need to stop and listen to every individual born-again christian to discover if they are the one that holds the key to my finally knowing the truth.
I do, in fact, have a very good idea as to how Thiel arrived at his position. I have a very good idea about why Strom Thurmond opposed the civil rights act of 1964. I have a very good idea that the sun will rise tomorrow.
> you go on this big rant that places you above him in terms of virtue
Yes, precisely. We all hold values. I find his to be in conflict with mine.
Or unless you're Trump! rimshot
http://fortune.com/2015/08/20/donald-trump-index-funds/
http://www.moneytalksnews.com/why-youre-probably-better-inve...
This dogma holds consolidation of power to be bad /in and of itself/, rather than because of a consequence, such as "consolidated power leads to suffering." If that's your opinion, fine, but it's no different than any other religion.