TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

What MongoDB got right

144 pointsby reqresover 9 years ago

12 comments

s_kilkover 9 years ago
&gt; Let&#x27;s start with the simplest one. Making the developer interface to the database a structured format instead of a textual query language was a clear win.<p>I think this is the most significant factor, by far. With Mongo it&#x27;s turtles (or at least Maps&#x2F;Hashes) all the way down, without a strange pseudo-english layer near the bottom that forces you to translate back and forth. For some devs that&#x27;s a big deal.<p>For the last while I&#x27;ve been experimenting with bringing the same feature to PostgreSQL (<a href="http:&#x2F;&#x2F;bedquiltdb.github.io" rel="nofollow">http:&#x2F;&#x2F;bedquiltdb.github.io</a>), turns out it&#x27;s very do-able, but I don&#x27;t have enough time to make it as featureful as it needs to be.
评论 #10559583 未加载
评论 #10559439 未加载
评论 #10559494 未加载
评论 #10560072 未加载
评论 #10559890 未加载
评论 #10560176 未加载
评论 #10561328 未加载
bryanlarsenover 9 years ago
&quot;So while MongoDB today may not be a great database, I think there&#x27;s a good chance that the MongoDB of 5 or 10 years from now truly will be.&quot;<p>Either MongoDB will be, or other databases that have learned the lessons, both good and bad, of MongoDB.<p>RethinkDB appears to have captured the &quot;MongoDB done right&quot; mindshare, and PostgreSQL has gained JSON and is gaining better replication in order to cover the same niches.
评论 #10559423 未加载
评论 #10560810 未加载
评论 #10560409 未加载
评论 #10559604 未加载
yummyfajitasover 9 years ago
Counting arguments very carefully? Nearly every SQL library does this for you.<p><pre><code> cur.execute(&quot;INSERT INTO a (b,c) VALUES (%(a)s, %(b)s);&quot;, { &#x27;a&#x27; : a, &#x27;b&#x27; : b }) </code></pre> Also, SQL is typed, so even if you did fail to count arguments there is a good chance you&#x27;d just detect it the first time you ran it.<p>The article acts as if treating the DB like native structures is somehow innovative and new - it&#x27;s not. <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Object_database" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Object_database</a><p>We mostly abandoned object databases because they sucked. SQL was a huge improvement over them. SQL is a great way to organize and preserve the integrity of a lot of business data.<p>It&#x27;s also a fantastic way to avoid repeated trips to the DB:<p><pre><code> SELECT * FROM employees AS e WHERE e.department_id = (SELECT id FROM departments WHERE name = &quot;engineering&quot;); </code></pre> In Mongo, I&#x27;m pretty sure you need to first lookup engineering, then lookup the employees in engineering. That could be O(# employees in engineering) queries rather than 1.
评论 #10561961 未加载
评论 #10561989 未加载
krisdolover 9 years ago
I don&#x27;t understand the recent backlash against NoSQL here.<p>First off, almost all of the complaints would have been valid years ago. Secondly, there is so much more choice out there today if mongodb wasn&#x27;t the right answer for your project, and so many NoSQL stores have had time to mature and get polished APIs and docs.<p>We use various data stores for different purpose across microservices, mostly ES, couchbase, and datomic, and &quot;use the right tool for the job&quot; and &quot;do one thing and do it well&quot; feels like the right approach to take. For most applications, a SQL DB feels like a really big hammer that is put to a lot of things that don&#x27;t look like nails.
评论 #10560431 未加载
评论 #10560701 未加载
评论 #10560157 未加载
评论 #10561381 未加载
评论 #10560184 未加载
rwmjover 9 years ago
Just a note that in PG&#x27;OCaml (an OCaml interface to PostgreSQL), you <i>can</i> write:<p><pre><code> &quot;insert into foo (col1,col2,col3) values ($a, $b, $c)&quot; </code></pre> and it creates the safe prepared statement with ? placeholders. At compile time. Type-checked against the database to make sure your program types match your column types.<p><a href="http:&#x2F;&#x2F;pgocaml.forge.ocamlcore.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;pgocaml.forge.ocamlcore.org&#x2F;</a>
评论 #10559524 未加载
ngrillyover 9 years ago
I agree that the three areas outlined in the article are things that MongoDB got right: a structured query language (instead of a textual query language), replica sets, and the oplog.<p>But the lack of transactions over multiple documents (in the same shard at least) and the lack of joins over multiple collections are a big showstopper for the kind of applications I develop.<p>I note that solutions like YouTube&#x27;s Vitess provide something similar to MongoDB&#x27;s replica sets.<p>I also note that PostgreSQL&#x27;s logical decoding provide the same functionality than MongoDB&#x27;s oplog tailing.
评论 #10559525 未加载
评论 #10559470 未加载
bsg75over 9 years ago
&gt; You can argue, and I would largely agree, that this is actually part of MongoDB&#x27;s brilliant marketing strategy, of sacrificing engineering quality in order to get to market faster and build a hype machine, with the idea that the engineering will follow later.<p>Author nearly lost me here with this logic. Placing Marketing ahead of quality in something that is supposed to store a <i>very</i> valuable asset (data) is near insanity.<p>I get the mindset of &quot;break fast&quot;, &quot;release often&quot;, etc. in terms of customer facing <i>features</i>, but in something that is supposed to be a core part of your foundation, stability is if utmost importance. Otherwise nothing else works - and you lose customers, business, opportunities - because you can&#x27;t look them up later.<p>Its not &quot;brilliant marketing&quot;, its just marketing.
评论 #10561365 未加载
emilburzoover 9 years ago
I have to agree with the author, especially since the points he raises are the ones that helped me greatly on my first &quot;serious&quot; personal project[1].<p>Coming from postgresql land I would have never thought you can have such great replication with automatic failover. I&#x27;ve had literally 100% uptime for the past year.<p>And that&#x27;s on commodity servers (one of them being in a room in my apartment, the other two in a proper datacenter) going through the usual upgrades, downtime, reboots, going from mongo 2 to mongo 3 and such.<p>Speaking of which, the migration from mongo2 to mongo3 was another pleasant surprise: they&#x27;ve made it backwards compatible. So I could do the upgrade on the servers, one by one, checking everything was ok and after that I could focus on updating the drivers and rewriting the deprecated queries, no need to have everything ready at once.<p>The accessible oplog was another gem that fit my project really well. Gone was the need to poll the database, I could just &quot;watch&quot; the oplog. That, coupled with long polling on the browser side meant I&#x27;d have very little chatter between the db&#x2F;server&#x2F;web client when idle. Websockets would have been nice, but adoption wasn&#x27;t high enough that I&#x27;d be comfortable going forward with it.<p>And all this considering MongoDB was my first NoSQL experience.<p>I agree it doesn&#x27;t fit every project, but when it does, it&#x27;s a really nice experience.<p>[1] <a href="https:&#x2F;&#x2F;graticule.link&#x2F;" rel="nofollow">https:&#x2F;&#x2F;graticule.link&#x2F;</a>
评论 #10559466 未加载
_yyover 9 years ago
RethinkDB took all the good parts of MongoDB and added proper engineering.<p><a href="https:&#x2F;&#x2F;www.rethinkdb.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.rethinkdb.com&#x2F;</a>
评论 #10560335 未加载
angelbobover 9 years ago
I love the point about the Oplog.<p>There are a few equivalents for common SQL DBs (see LinkedIn&#x27;s Databus for Oracle and MySQL), but in general, getting access to the write log is really hard. Even though it&#x27;s sitting there!<p>It would be wonderful if there were some kind of established API or library that would let you parse the MySQL write log without doing hideous, fragile operations that change from version to version. Sure, change the format, but at least version and document it!
srikuover 9 years ago
When we chose MongoDB for a project, a dominant criterion was out of the box geo queries. It helped that the storage and query approach had good impedance match with NodeJS. From a query perspective, we wouldn&#x27;t have benefited much from SQL anyway, since much of the reading is free text or social graph or location based search which we moved to Solr.
franzwongover 9 years ago
It becomes much simpler to setup replication in PostgreSQL than before.<p>reference: <a href="https:&#x2F;&#x2F;www.digitalocean.com&#x2F;community&#x2F;tutorials&#x2F;how-to-set-up-master-slave-replication-on-postgresql-on-an-ubuntu-12-04-vps" rel="nofollow">https:&#x2F;&#x2F;www.digitalocean.com&#x2F;community&#x2F;tutorials&#x2F;how-to-set-...</a>