Skip to content
documentdb

documentdb

documentdb : API surface for DocumentDB for PostgreSQL

Overview

ID Extension Package Version Category License Language
9000
documentdb
documentdb
0.113
SIM
MIT
C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--sLd--
No
Yes
Yes
Yes
no
no
Relationships
Requires
documentdb_core
pg_cron
postgis
tsm_system_rows
vector
Need By
documentdb_distributed
documentdb_extended_rum
See Also
mongo_fdw
wal2mongo
pg_jsonschema
jsquery
Siblings
documentdb_core
documentdb_distributed
documentdb_extended_rum

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT
PIGSTY
0.113
18
17
16
15
14
documentdb documentdb_core, pg_cron, postgis, tsm_system_rows, vector
RPM
PIGSTY
0.113
18
17
16
15
14
documentdb_$v postgresql$v-contrib, pg_cron_$v, pgvector_$v, rum_$v, postgis36_$v
DEB
PIGSTY
0.113
18
17
16
15
14
postgresql-$v-documentdb postgresql-$v-cron, postgresql-$v-pgvector, postgresql-$v-rum, postgresql-$v-postgis-3
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
MISS
el8.aarch64
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
MISS
el9.x86_64
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
MISS
el9.aarch64
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
MISS
el10.x86_64
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
MISS
el10.aarch64
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
MISS
d12.x86_64
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
MISS
d12.aarch64
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
MISS
d13.x86_64
PGDG 0.113
PGDG 0.113
PGDG 0.113
PGDG 0.113
MISS
d13.aarch64
PGDG 0.113
PGDG 0.113
PGDG 0.113
PGDG 0.113
MISS
u22.x86_64
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
MISS
u22.aarch64
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
MISS
u24.x86_64
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
MISS
u24.aarch64
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
PIGSTY 0.113
MISS
u26.x86_64
PGDG 0.113
PGDG 0.113
PGDG 0.113
PGDG 0.113
MISS
u26.aarch64
PGDG 0.113
PGDG 0.113
PGDG 0.113
PGDG 0.113
MISS
Package Version OS ORG SIZE File URL
documentdb_18 0.113 el8.x86_64 pigsty 3.0 MiB documentdb_18-0.113-0PIGSTY.el8.x86_64.rpm
documentdb_18 0.113 el8.aarch64 pigsty 2.9 MiB documentdb_18-0.113-0PIGSTY.el8.aarch64.rpm
documentdb_18 0.113 el9.x86_64 pigsty 2.9 MiB documentdb_18-0.113-0PIGSTY.el9.x86_64.rpm
documentdb_18 0.113 el9.aarch64 pigsty 2.8 MiB documentdb_18-0.113-0PIGSTY.el9.aarch64.rpm
documentdb_18 0.113 el10.x86_64 pigsty 2.9 MiB documentdb_18-0.113-0PIGSTY.el10.x86_64.rpm
documentdb_18 0.113 el10.aarch64 pigsty 2.8 MiB documentdb_18-0.113-0PIGSTY.el10.aarch64.rpm
postgresql-18-documentdb 0.113 d12.x86_64 pigsty 5.2 MiB postgresql-18-documentdb_0.113-0PIGSTY~bookworm_amd64.deb
postgresql-18-documentdb 0.113 d12.aarch64 pigsty 5.0 MiB postgresql-18-documentdb_0.113-0PIGSTY~bookworm_arm64.deb
postgresql-18-documentdb 0.113 d13.x86_64 pgdg 5.0 MiB postgresql-18-documentdb_0.113-0-1.pgdg13+1_amd64.deb
postgresql-18-documentdb 0.113 d13.x86_64 pigsty 5.2 MiB postgresql-18-documentdb_0.113-0PIGSTY~trixie_amd64.deb
postgresql-18-documentdb 0.112 d13.x86_64 pgdg 4.9 MiB postgresql-18-documentdb_0.112-0-1.pgdg13+1_amd64.deb
postgresql-18-documentdb 0.108 d13.x86_64 pgdg 4.6 MiB postgresql-18-documentdb_0.108-0-1.pgdg13+1_amd64.deb
postgresql-18-documentdb 0.113 d13.aarch64 pgdg 4.8 MiB postgresql-18-documentdb_0.113-0-1.pgdg13+1_arm64.deb
postgresql-18-documentdb 0.113 d13.aarch64 pigsty 5.0 MiB postgresql-18-documentdb_0.113-0PIGSTY~trixie_arm64.deb
postgresql-18-documentdb 0.112 d13.aarch64 pgdg 4.8 MiB postgresql-18-documentdb_0.112-0-1.pgdg13+1_arm64.deb
postgresql-18-documentdb 0.108 d13.aarch64 pgdg 4.4 MiB postgresql-18-documentdb_0.108-0-1.pgdg13+1_arm64.deb
postgresql-18-documentdb 0.113 u22.x86_64 pigsty 5.5 MiB postgresql-18-documentdb_0.113-0PIGSTY~jammy_amd64.deb
postgresql-18-documentdb 0.113 u22.aarch64 pigsty 5.4 MiB postgresql-18-documentdb_0.113-0PIGSTY~jammy_arm64.deb
postgresql-18-documentdb 0.113 u24.x86_64 pigsty 5.4 MiB postgresql-18-documentdb_0.113-0PIGSTY~noble_amd64.deb
postgresql-18-documentdb 0.113 u24.aarch64 pigsty 5.3 MiB postgresql-18-documentdb_0.113-0PIGSTY~noble_arm64.deb
postgresql-18-documentdb 0.113 u26.x86_64 pgdg 4.9 MiB postgresql-18-documentdb_0.113-0-1.pgdg26.04+1_amd64.deb
postgresql-18-documentdb 0.113 u26.x86_64 pigsty 5.4 MiB postgresql-18-documentdb_0.113-0PIGSTY~resolute_amd64.deb
postgresql-18-documentdb 0.112 u26.x86_64 pgdg 4.8 MiB postgresql-18-documentdb_0.112-0-1.pgdg26.04+1_amd64.deb
postgresql-18-documentdb 0.108 u26.x86_64 pgdg 4.5 MiB postgresql-18-documentdb_0.108-0-1.pgdg26.04+1_amd64.deb
postgresql-18-documentdb 0.113 u26.aarch64 pgdg 4.7 MiB postgresql-18-documentdb_0.113-0-1.pgdg26.04+1_arm64.deb
postgresql-18-documentdb 0.113 u26.aarch64 pigsty 5.3 MiB postgresql-18-documentdb_0.113-0PIGSTY~resolute_arm64.deb
postgresql-18-documentdb 0.112 u26.aarch64 pgdg 4.7 MiB postgresql-18-documentdb_0.112-0-1.pgdg26.04+1_arm64.deb
postgresql-18-documentdb 0.108 u26.aarch64 pgdg 4.3 MiB postgresql-18-documentdb_0.108-0-1.pgdg26.04+1_arm64.deb

Source

pig build pkg documentdb;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install documentdb;		# install via package name, for the active PG version

pig install documentdb -v 18;   # install for PG 18
pig install documentdb -v 17;   # install for PG 17
pig install documentdb -v 16;   # install for PG 16
pig install documentdb -v 15;   # install for PG 15

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'pg_documentdb, pg_documentdb_core, pg_cron';

Create this extension with:

CREATE EXTENSION documentdb CASCADE; -- requires documentdb_core, pg_cron, postgis, tsm_system_rows, vector

Usage

Sources: README, CHANGELOG, documentdb.control, documentdb_core.control, documentdb_extended_rum.control

documentdb is a MongoDB-compatible document database implemented as PostgreSQL extensions. It adds BSON storage and APIs in PostgreSQL, plus an optional gateway layer for MongoDB wire-protocol clients. FerretDB 2.0+ can use DocumentDB as its backend.

Components

The public extension surface is split across related extensions:

  • documentdb_core: BSON datatype and low-level BSON operations.
  • documentdb: public API for document CRUD and query behavior.
  • documentdb_extended_rum: extended RUM access method used by DocumentDB indexing.
  • pg_documentdb_gw: gateway protocol layer used by the local Docker image and MongoDB-compatible clients.

Install the SQL extension in each database that needs the API:

CREATE EXTENSION IF NOT EXISTS documentdb CASCADE;

The documentdb.control file for 0.113-0 declares dependencies on documentdb_core, pg_cron, tsm_system_rows, vector, and postgis. The gateway container listens on a MongoDB-compatible port; the README examples use 10260 to avoid colliding with local MongoDB services.

MongoDB Client Example

import pymongo

client = pymongo.MongoClient(
    "mongodb://user:pass@localhost:10260/?tls=true&tlsAllowInvalidCertificates=true"
)

db = client["quickStartDatabase"]
coll = db.create_collection("quickStartCollection")

coll.insert_one({"name": "Alice", "email": "[email protected]"})
print(coll.find_one({"name": "Alice"}))

The upstream README also demonstrates aggregation pipelines through normal MongoDB drivers:

pipeline = [
    {"$match": {"name": "Alice"}},
    {"$project": {"_id": 0, "name": 1, "email": 1}},
]

for doc in coll.aggregate(pipeline):
    print(doc)

Version Notes

This project’s CSV tracks DocumentDB 0.113 for PostgreSQL 15-18. The upstream tag is v0.113-0; control files report default_version = '0.113-0'.

The 0.111 through 0.113 changelog entries are mostly query-planner, collation, and index correctness work:

  • 0.113-0 adds opt-in collation support for non-unique ordered indexes with $in and $nin, and supports pruning dead index entries on ordered TTL indexes behind feature flags.
  • 0.112-0 removes the legacy composite-returning bson_update_document UDF path, expands non-unique ordered-index collation support, and improves $group and accumulator execution.
  • 0.111-0 adds background init job infrastructure, more $group validation, collation/index pushdown improvements, and several crash fixes.

Caveats

  • DocumentDB is a multi-extension stack; CREATE EXTENSION documentdb CASCADE is the normal entry point, but operational deployments also need the gateway/runtime pieces if MongoDB wire compatibility is required.
  • Some features listed in the changelog are gated by documentdb.* feature flags. Verify flag defaults in the exact installed build before documenting behavior as always-on.
  • documentdb_extended_rum is relocatable, but documentdb and documentdb_core are not.
Last updated on