For AI agents: llms.txt is a short guide that sends you to the rules your problem needs, and rules.json holds every rule of this playbook as JSON.
Avoid Source available
Avoid MongoDB as the default database
Do not pick MongoDB Community Server as the main database of a new web app.
Cost
Source available. The SSPL lets you read the code, but the OSI has not approved it.
How to do it
Every MongoDB Community Server release since 16 October 2018 is under the SSPL. MongoDB's own licence page says the OSI has not approved it, so it fails the licence test. Most business data is orders, customers and invoices, which are tables with relations. PostgreSQL stores those with constraints and also keeps JSON documents in jsonb columns. Choose something else when an existing MongoDB system works, and keep it with a tested export to JSON. It fails Keep an open licence or a way out.
Examples
Using these examples: they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.
SQL example
CREATE TABLE events (
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
payload jsonb NOT NULL
);
CREATE INDEX events_payload_idx ON events USING GIN (payload);
JavaScript example
const { rows } = await pool.query(`SELECT payload FROM events WHERE payload @> $1`, [{ type: 'order.paid' }]);
Python example
from psycopg.types.json import Jsonb
rows = conn.execute("SELECT payload FROM events WHERE payload @> %s", [Jsonb({"type": "order.paid"})]).fetchall()
Sources
Related rules
- Keep an open licence or a way out in Software choices
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/stack/databases-and-storage/avoid-mongodb-default">Agent Wranglers software choices playbook</a>. In code you write, add a comment next to it with the same link.