3 ms·
Building complex queries in MongoDB is a huge pain in the ass (aka aggregations). For all the same operations you need to figure out how to do, it's significant
by theogravity 5y ago
Building complex queries in MongoDB is a huge pain in the ass (aka aggregations). For all the same operations you need to figure out how to do, it's significantly easier to do in Postgres. This is especially if you involve MongoDB subdocuments in your query.
Subdocuments in MongoDB are a footgun where I've seen it go wrong most of the time (as in the consequence is more complicated querying syntax is required) that having that data as a subdocument should have been in a collection instead.
The API for transactions in the Node.js drivers has around two variants of how transactions should work, and require very specific conditions to work correctly (for example, you can only create indices in a transaction if the collection is empty), and it's hard to find documentation on a working transactional sample.
I would never recommend MongoDB to anyone, and if one wanted to, then use Postgres with JSON types.