Skip to content

Compatibility

How DocumentDB and the gateway divide MongoDB compatibility, what the packaged extensions support, and what remains untested in Mimus.

This page describes the earlier PG18 stack. DocumentDB and its wire-protocol gateway implement different parts of MongoDB compatibility. The FerretDB and DocumentDB versions below belong to that upstream environment. The 19.0.1-r4 checks used the standalone DocumentDB gateway. Current verification scope

For the authoritative, version-specific command and operator matrices, consult the upstream documentation:

What each layer covers

LayerComponentCompatibility responsibility
Wire protocol and session handlingFerretDB (2.7.0) or DocumentDB gatewayMongoDB wire framing (OP_MSG), driver handshakes (hello / isMaster), connection pooling, wire-level authentication and translation of client commands into SQL calls
BSON storage, operators and indexingdocumentdb (1.0-0), documentdb_core, documentdb_extended_rumBSON binary type (documentdb_core.bson), comparison and numeric rules, collection CRUD, aggregation pipeline execution, RUM path indexing, geospatial (postgis), vector (pgvector) and full-text queries

Capabilities in the packaged DocumentDB 1.0 stack

Based on the DocumentDB 1.0-0 PostgreSQL packages shipped by PGDG and Pigsty (for PostgreSQL 15–18):

  • BSON type and path operations (documentdb_core): stores documents as documentdb_core.bson (with bsonquery and bsonsequence), provides path extraction (->, ->>, bson_get_value, bson_get_value_text), bytea/JSON conversion (bson_from_bytea, bson_to_bytea, bson_json_to_bson, bson_to_json_string), and B-tree and hash operator classes (bson_btree_ops, bson_hash_ops). Comparison, numeric promotion and indexing semantics follow DocumentDB’s BSON implementation rather than PostgreSQL jsonb.
  • Collection CRUD and aggregation (documentdb): exposes collection management (documentdb_api.create_collection), document writes (documentdb_api.insert_one and update/delete functions) and BSON query and aggregation execution (documentdb_api_catalog.bson_aggregation_find).
  • Indexing (documentdb_extended_rum): provides an extended RUM index access method tailored for BSON documents and nested paths (documentdb.rum_library_load_option = 'require_documentdb_extended_rum'), including background non-blocking unique index builds (documentdb.enableNonBlockingUniqueIndexBuild, enabled by default since v0.114) and posting-tree/leaf vacuum pruning in 1.0-0.
  • Geospatial and vector workloads: integrates with postgis for geospatial queries and vector (pgvector) for vector similarity search (CREATE EXTENSION documentdb CASCADE installs both dependencies).

Known limitations and operational boundaries

  • Not identical to every MongoDB server version: DocumentDB 1.0-0 and FerretDB do not implement every command, aggregation stage or edge case of every MongoDB release. Applications should test the specific operators, index options, transaction patterns, schema validation rules and driver versions they rely on.
  • Authentication without MongoDB RBAC:
    • In Pigsty’s mongo template, FerretDB enables authentication (FERRETDB_AUTH: true) and checks credentials against PostgreSQL roles, but does not implement MongoDB role-based authorization. MongoDB roles cannot be used to isolate privileges.
    • In DocumentDB 1.0-0, custom role CRUD and post-join nested $lookup remain disabled by default behind feature flags.
  • Version matching across components: documentdb, documentdb_core and documentdb_extended_rum must come from the same release line, and release upgrade SQL must be applied when updating existing databases. Because FerretDB releases specify a preferred DocumentDB version, run an authenticated CRUD smoke test after upgrading either FerretDB or documentdb.
  • r4 selects one compatibility protocol per instance. The connections guide documents the single-node DocumentDB gateway and logical restore checks.
Scan to open this page
https://mimus.pgsty.com/docs/mongo/compatibility/