Hacker News new | ask | show | jobs
by lllr_finger 2217 days ago
Mongo has been related to "perpetual irritation" up to "major production issue" at all three of my last companies.

For as easy as it is to use jsonb in Postgres, or Redis, or RocksDB/SQLite, or whatever else depending on your use case - I can't find any reason to advocate its use these days. In my anecdotal experience, the success stories never happen, and nearly developer I know has an unpleasant experience they can share.

Big thanks to aphyr and the Jepsen suite (and unrelated blog posts like Hexing the Interview) for inspiring me to do thorough engineering.

2 comments

I find that using JSON for things you don't need to query/validate (like big blobs you just want to store) and breaking the rest out to columns works well enough. Plus, you can always migrate the data out to a field anyway.
Postgres 12 has generated columns, so you can throw your data in a jsonb column and have Postgres pull data out of it into separate columns for indexing for example.
Generated columns are not necessary for indexing in Postgres, you can create an index on any expression based on the record (supported by many versions now).
Is Postgres what most people would suggest as a MongoDB replacement?

Anyone have any suggestions for a true non-MongoDB jsonDocument based noSql option?

The first question you must ask yourself is: do I really need a document store?

Because the answer is "no" in the overwhelmingly majority of cases, specially if your product is mature.

Or trust me, I'm aware. But inevitably I will be in a design meeting where they will want a non-sql alternative, and I'd be nice to know what I can suggest besides Mongo
It depends what you're using it for. Postgres is a very good all-around choice these days (compared to when the whole 'noSql' thing got started) and also supports document-based scenarios quite well via JSON/JSONB columns and its support for these datatypes in queries, updates, indexing etc. Sharding and replication can also be set up via fairly general mechanisms, as described in pgSQL documentation. (For instance, the FDW facility is often used to set up sharding, but it could also support e.g. aggregation.)
Note that there is no Jepsen test for those sharding/replication features.
As has been mentioned above PostgreSQL does not come out of the box with a supported, tested clustering solution.

Given that is a pretty popular part of MongoDB seems like an important thing for people to continuously fail to mention.