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.

Ask HN: What is your opinion on mongo db?

12 pointsby kamalkishor1991about 5 years ago
I always thought relational dbs are always better except may be really narro usecase of horizontal scalability Please share your opinion? Maybe I am missing something obvious. Lot of people seem to like mongo db a lot and most of the reasons does not make much sense to me.

11 comments

eindiranabout 5 years ago
In my experience, it depends on what data you are trying to store. Is your data composed of JSON documents which may be partially or fully unstructured? Are you pretty sure this isn&#x27;t going to change? Then consider using Mongo. Otherwise, the decision may (will) bite you in the ass at some point when you end up needing some features of a relational database. The flip side of this is that it can be a boon to use Mongo if you are consuming data that may suddenly change without notice.<p>Some amount of future-proofing can be done in the case where your data is currently unstructured JSON, but you may need what a relational database offers in the future by using something like Postgres with the JSON data type. But there are tradeoffs between Postgres + JSON and Mongo that you may need to play with to decide which is better for your usecase.
评论 #23187112 未加载
legostormtrooprabout 5 years ago
Pros: its webscale.<p>Cons: No transactional consistency, you lose all the Pros of relational databases.<p>Unless you absolutely know why you want to use Mongo (and there are cases, probably), you don&#x27;t want to use it.
superflitabout 5 years ago
My cynical opinion.<p>Mongo is a JSON repository.<p>Good for: When you have to transact with an ever changing and evolving API that you do not have control.<p>Looks good on Resume, Looks bad on Costs.
karmakazeabout 5 years ago
MongoDB used to suck in many ways. Since ver 3.2 with the WiredTiger storage engine, it only sucks in the ways that you&#x27;d expect using a schema-less document store. WiredTiger is kind of like InnoDB in how MySQL used to suck before it.<p>Using JSON with either PostgreSQL (JSONB) or MySQL is probably a much better bet. If you scale to the point that you really need sharding and not just multi-master and&#x2F;or read replicas, then you can probably afford the migration.
_bxg1about 5 years ago
The couple of times I&#x27;ve made something with Mongo, I&#x27;ve always just found myself defining a schema in the source code anyway. As long as some code eventually reads the data there&#x27;s no such thing as &quot;no schema&quot;, there&#x27;s just &quot;multiple&quot; or &quot;less precise&quot; schemas: <a href="https:&#x2F;&#x2F;utcc.utoronto.ca&#x2F;~cks&#x2F;space&#x2F;blog&#x2F;programming&#x2F;DatabasesAlwaysSchemas" rel="nofollow">https:&#x2F;&#x2F;utcc.utoronto.ca&#x2F;~cks&#x2F;space&#x2F;blog&#x2F;programming&#x2F;Databas...</a><p>All this is to say: from a software engineering standpoint I like defining my schema rigidly at the DB level. The added flexibility that NoSQL provides is not something I actually find desirable. That said, I&#x27;ve never had to share one of these DBs with other programmers.
NicoJuicyabout 5 years ago
I used to prefer relational db&#x27;s, but ever since DDD I&#x27;ve been switching my opinion.<p>Currently, my go to library is MartenDb which has the best of both worlds.<p>Documents with duplicated properties for queries.<p><a href="https:&#x2F;&#x2F;martendb.io&#x2F;documentation&#x2F;documents&#x2F;customizing&#x2F;duplicated_fields&#x2F;" rel="nofollow">https:&#x2F;&#x2F;martendb.io&#x2F;documentation&#x2F;documents&#x2F;customizing&#x2F;dupl...</a><p>If you want a more detailed answer, let me know, since it could take a while to write everything down :p<p>The alternative for this with mongo db is an elastic search on top of it for queries. But yeah, that doesn&#x27;t feel good&#x2F;overkill.
bradknowlesabout 5 years ago
It’s fine, so long as you want to store random assortments of random documents, in small collections, and you can get all that into a single machine.<p>As soon as you need to scale it up by sharding or replicating, you’re fucked.
nine_kabout 5 years ago
I&#x27;ve seen Mongo the company making technical decisions which I find reckless (like no write confirmation by default). Since it was not once and not twice, I decided that I just want to stay away from them.<p>Do I want smaller scale JSON DB? Postgres fits perfectly. And it works until surprisingly large scales, unless your update load is massive.<p>Do I need a truly distributed HA DB with JSON support? Well, Cassandra used to be fine.
brianmccabout 5 years ago
You might find this a useful discussion and article from a couple of years back:<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=18717168" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=18717168</a>
toomuchtodoabout 5 years ago
Use PostgreSQL instead.
评论 #23186835 未加载
oblibabout 5 years ago
I&#x27;m not really familiar with mongo db but I have been working with couchdb for awhile now.<p>I just posted a &quot;Show HN&quot; of a simple demo app I made that uses CouchDB installed on the client side. CouchDB will run a Mac, Windows, and Linux desktop PCs.<p>The demo uses PouchDB.js to interact with CouchDB. PouchDB is really pretty sweet.<p>Take a look at the demo and play around with it a bit. There are two web pages that are both self contained. One sets up a user and db, the other demonstrates crud routines.<p><a href="https:&#x2F;&#x2F;cherrypc.com&#x2F;app&#x2F;editor&#x2F;setup.html" rel="nofollow">https:&#x2F;&#x2F;cherrypc.com&#x2F;app&#x2F;editor&#x2F;setup.html</a><p><a href="https:&#x2F;&#x2F;cherrypc.com&#x2F;app&#x2F;editor&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;cherrypc.com&#x2F;app&#x2F;editor&#x2F;index.html</a><p>Also check out the PouchDB docs: <a href="https:&#x2F;&#x2F;pouchdb.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pouchdb.com&#x2F;</a>