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.
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'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.
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't want to use it.
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.
MongoDB used to suck in many ways. Since ver 3.2 with the WiredTiger storage engine, it only sucks in the ways that you'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/or read replicas, then you can probably afford the migration.
The couple of times I've made something with Mongo, I've always just found myself defining a schema in the source code anyway. As long as some code eventually reads the data there's no such thing as "no schema", there's just "multiple" or "less precise" schemas: <a href="https://utcc.utoronto.ca/~cks/space/blog/programming/DatabasesAlwaysSchemas" rel="nofollow">https://utcc.utoronto.ca/~cks/space/blog/programming/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've never had to share one of these DBs with other programmers.
I used to prefer relational db's, but ever since DDD I'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://martendb.io/documentation/documents/customizing/duplicated_fields/" rel="nofollow">https://martendb.io/documentation/documents/customizing/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't feel good/overkill.
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.
I'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.
You might find this a useful discussion and article from a couple of years back:<p><a href="https://news.ycombinator.com/item?id=18717168" rel="nofollow">https://news.ycombinator.com/item?id=18717168</a>
I'm not really familiar with mongo db but I have been working with couchdb for awhile now.<p>I just posted a "Show HN" 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://cherrypc.com/app/editor/setup.html" rel="nofollow">https://cherrypc.com/app/editor/setup.html</a><p><a href="https://cherrypc.com/app/editor/index.html" rel="nofollow">https://cherrypc.com/app/editor/index.html</a><p>Also check out the PouchDB docs: <a href="https://pouchdb.com/" rel="nofollow">https://pouchdb.com/</a>