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
|
Source
pig build pkg documentdb; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall 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 15Config 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, vectorUsage
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-0adds opt-in collation support for non-unique ordered indexes with$inand$nin, and supports pruning dead index entries on ordered TTL indexes behind feature flags.0.112-0removes the legacy composite-returningbson_update_documentUDF path, expands non-unique ordered-index collation support, and improves$groupand accumulator execution.0.111-0adds background init job infrastructure, more$groupvalidation, collation/index pushdown improvements, and several crash fixes.
Caveats
- DocumentDB is a multi-extension stack;
CREATE EXTENSION documentdb CASCADEis 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_rumis relocatable, butdocumentdbanddocumentdb_coreare not.