[{"data":1,"prerenderedAt":29},["ShallowReactive",2],{"$f7o5Uocg8ZQVWfUlFN-IVfuYSmEr2yetd3MAVf0P-rtQ":3},{"slug":4,"title":5,"description":6,"date":7,"tags":8,"draft":13,"readingMinutes":14,"html":15,"related":16},"postgres-vs-mongodb","Postgres vs MongoDB: Pick by the Questions You'll Ask Later","Postgres vs MongoDB in November 2026: Postgres 19 just shipped, MongoDB 8.3, JSONB vs documents, joins, transactions, licensing, and how I choose for a new app.","2026-11-22",[9,10,11,12],"postgres","mongodb","databases","backend",false,5,"\u003Cp>Postgres or MongoDB for a new app? I&#39;d pick Postgres for almost every product I get asked to build: anything with users, payments, orders, permissions or reports. I&#39;d pick MongoDB when the data really is a pile of self-contained documents with shapes that keep changing and that nobody needs to join, like event payloads, scraped pages or per-tenant configs.\u003C/p>\n\u003Cp>Most of my database work has been on MySQL and Postgres, with some MongoDB along the way, so I&#39;m not neutral. But the reason I lean this way isn&#39;t loyalty. It&#39;s that the choice gets made on day one, when the data looks simple, and it gets tested on day 300, when someone asks a question across three collections that were never meant to meet.\u003C/p>\n\u003Cp>Versions checked on November 22, 2026: the \u003Ca href=\"https://www.postgresql.org/\">PostgreSQL home page\u003C/a> and the \u003Ca href=\"https://www.mongodb.com/docs/manual/release-notes/8.3/\">MongoDB 8.3 release notes\u003C/a>.\u003C/p>\n\u003Ch2>Where both are right now\u003C/h2>\n\u003Cp>\u003Cstrong>Postgres 19\u003C/strong> came out three days ago, on November 19, 2026. The \u003Ca href=\"https://www.postgresql.org/about/news/postgresql-19-released-3449/\">release announcement\u003C/a> is mostly operations work: \u003Ccode>REPACK (CONCURRENTLY)\u003C/code> finally reclaims space from a bloated table without locking it (it replaces \u003Ccode>VACUUM FULL\u003C/code> and \u003Ccode>CLUSTER\u003C/code>), \u003Ccode>INSERT ... ON CONFLICT DO SELECT\u003C/code> returns the existing row so &quot;get or create&quot; is one statement, foreign key checks on bulk inserts are close to twice as fast in their testing, and JIT is now off by default because its cost estimates &quot;proved unreliable&quot;. For JSON people, \u003Ccode>COPY\u003C/code> can now write JSON out directly and the SQL/JSON path language gained \u003Ccode>lower()\u003C/code>, \u003Ccode>upper()\u003C/code>, \u003Ccode>replace()\u003C/code>, \u003Ccode>split_part()\u003C/code> and \u003Ccode>btrim()\u003C/code>.\u003C/p>\n\u003Cp>\u003Cstrong>MongoDB 8.3\u003C/strong> is the current release line, with 8.3.13 out since October 13, 2026. If you run 8.3.0 through 8.3.12, read the advisory in the release notes (SERVER-131805) and patch.\u003C/p>\n\u003Cp>Neither of these changes the decision much. The decision is about your data.\u003C/p>\n\u003Ch2>The data model is the whole argument\u003C/h2>\n\u003Cp>In MongoDB, an order is one document: the customer&#39;s name, the shipping address, the line items, the payment status, all nested in one JSON-like object. Reading it is one fetch. Writing it is one write. For the screen that shows a single order, this is lovely.\u003C/p>\n\u003Cp>In Postgres, the same order is spread across \u003Ccode>orders\u003C/code>, \u003Ccode>order_items\u003C/code>, \u003Ccode>customers\u003C/code> and probably \u003Ccode>addresses\u003C/code>, joined back together when you read it. More typing up front. In return, the customer exists once. When they change their email, it&#39;s changed everywhere, and &quot;how much did customers in Germany spend on product X last quarter&quot; is one SQL query that the planner is very good at.\u003C/p>\n\u003Cimg src=\"/blog/postgres-vs-mongodb/one-order-two-models.webp\" alt=\"The same order stored as one MongoDB document and as four Postgres tables, with the reporting query each one makes easy or hard\" width=\"1600\" height=\"900\" loading=\"lazy\">\u003Cp>MongoDB can do that report too. \u003Ccode>$lookup\u003C/code> joins collections in an aggregation pipeline, and it works. But you&#39;re now writing joins in a pipeline syntax, against data that was embedded to avoid joins, and the copy of the customer&#39;s email inside last year&#39;s orders is whatever it was last year. Sometimes that&#39;s what you want (an invoice should keep the address it shipped to). Often it&#39;s an accident nobody noticed.\u003C/p>\n\u003Ch2>&quot;But Postgres can store JSON&quot;\u003C/h2>\n\u003Cp>It can, and well. A \u003Ccode>jsonb\u003C/code> column stores binary JSON, a GIN index makes queries on its keys fast, and you can mix it with normal columns in the same table. The usual pattern I like: real columns for the things you filter, join and sort on (\u003Ccode>id\u003C/code>, \u003Ccode>user_id\u003C/code>, \u003Ccode>status\u003C/code>, \u003Ccode>created_at\u003C/code>) and one \u003Ccode>jsonb\u003C/code> column for the part that keeps changing shape, like a webhook payload or form answers.\u003C/p>\n\u003Cp>That covers most of the &quot;our schema isn&#39;t settled yet&quot; argument for MongoDB. What it doesn&#39;t give you is MongoDB&#39;s ergonomics for deeply nested updates. Changing one field three levels down inside an array in \u003Ccode>jsonb\u003C/code> is \u003Ccode>jsonb_set\u003C/code> with a path, and it rewrites the whole value. In MongoDB it&#39;s an \u003Ccode>$set\u003C/code> with a positional operator and nobody thinks about it.\u003C/p>\n\u003Ch2>Transactions and integrity\u003C/h2>\n\u003Cp>Both have multi-document or multi-row transactions now. MongoDB has had multi-document ACID transactions since 4.0, and they work. The difference is in the defaults and the culture around them. In Postgres, foreign keys, \u003Ccode>NOT NULL\u003C/code>, \u003Ccode>CHECK\u003C/code> and unique constraints stop bad data at the door, and you get them by writing the table. In MongoDB, schema validation exists (\u003Ccode>$jsonSchema\u003C/code> on a collection), but it&#39;s optional, and plenty of projects never turn it on.\u003C/p>\n\u003Cp>If two parts of your app can both write to the same record, I want the database enforcing the rules, not every code path remembering them.\u003C/p>\n\u003Ch2>Scaling, honestly\u003C/h2>\n\u003Cp>MongoDB&#39;s selling point here is real: sharding is built in. You pick a shard key and the cluster spreads data across machines. Postgres scales up a long way on one machine plus read replicas, and past that you&#39;re looking at Citus, partitioning or splitting the app, all of which are more work than MongoDB&#39;s version.\u003C/p>\n\u003Cp>The catch is that almost nobody I work with is anywhere near that line. A single Postgres instance on decent hardware handles a lot more than a startup&#39;s first few years. Choosing a database for the scale you hope to have in five years, at the price of awkward queries every week until then, is a bad trade.\u003C/p>\n\u003Ch2>Licensing and hosting\u003C/h2>\n\u003Cp>Postgres uses the PostgreSQL License, a short permissive one. You can run it anywhere, and every cloud sells it managed: RDS, Cloud SQL, Supabase, Neon and more.\u003C/p>\n\u003Cp>MongoDB Community is under the SSPL, which isn&#39;t an OSI-approved open source license. For running your own app it doesn&#39;t matter. It&#39;s why AWS sells DocumentDB, which is MongoDB-compatible but not MongoDB, and why the managed option most people end up on is MongoDB&#39;s own Atlas. That&#39;s fine, but it&#39;s one vendor, and Atlas pricing has its own quirks.\u003C/p>\n\u003Ch2>How I actually decide\u003C/h2>\n\u003Cp>I ask what the hardest question anyone will ask of this data in a year looks like. If it&#39;s &quot;show me this one thing, fast&quot;, and the things don&#39;t relate to each other much, MongoDB is a fine fit and I won&#39;t argue. If it&#39;s &quot;how many, how much, which ones, compared to what&quot;, I use Postgres, with a \u003Ccode>jsonb\u003C/code> column where the shape is still moving.\u003C/p>\n\u003Cp>For most SaaS apps, marketplaces and internal tools, that second kind of question shows up in the first month, usually from whoever does the finance.\u003C/p>\n\u003Cp>If you&#39;re stuck on a database choice for an app you&#39;re building, or moving off one you picked too early, I take on that kind of \u003Ca href=\"/services/full-stack-development\">full-stack work\u003C/a>. \u003Ca href=\"https://calendly.com/director-norsky/meeting\">Book a free call\u003C/a>; all consultation is free.\u003C/p>\n",[17,21,25],{"slug":18,"title":19,"description":20},"sqlite-vs-postgres","SQLite vs Postgres: Pick by Writers, Not by Size","SQLite vs Postgres in 2026: SQLite 3.54 and Postgres 18. Why the number of processes writing at once decides it, not traffic or data size.",{"slug":22,"title":23,"description":24},"mysql-vs-postgres","MySQL vs Postgres: What Actually Bites You in 2026","MySQL vs Postgres in November 2026: MySQL 9.7 LTS and calendar versions, Postgres 19 RC, and the collation and migration surprises that bite when you switch.",{"slug":26,"title":27,"description":28},"neon-vs-supabase","Neon vs Supabase: Which Postgres Should You Pick?","Neon vs Supabase in October 2026: same Postgres, different bills. Scale-to-zero vs a flat $25, branches vs projects, and which one fits which app.",1795910046751]