documentdb_core

Core API surface for DocumentDB on PostgreSQL

Overview

PackageVersionCategoryLicenseLanguage
documentdb0.114SIMMITC
IDExtensionBinLibLoadCreateTrustRelocSchema
9000documentdbNoYesYesYesNoNo-
9010documentdb_coreNoYesYesYesNoNo-
9020documentdb_distributedNoYesYesYesNoNo-
9030documentdb_extended_rumNoYesYesYesNoYes-
Relatedmongo_fdw rum pg_jsonschema jsquery pg_cron postgis vector
Depended Bydocumentdb documentdb_distributed

Version

TypeRepoVersionPG VerPackageDeps
EXTPIGSTY0.1141817161514documentdb-
RPMPIGSTY0.1141817161514documentdb_$vpostgresql$v-contrib, pg_cron_$v, pgvector_$v, rum_$v, postgis36_$v
DEBPIGSTY0.1141817161514postgresql-$v-documentdbpostgresql-$v-cron, postgresql-$v-pgvector, postgresql-$v-rum, postgresql-$v-postgis-3
OS / PGPG18PG17PG16PG15PG14
el8.x86_64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
el8.aarch64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
el9.x86_64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
el9.aarch64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
el10.x86_64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
el10.aarch64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
d12.x86_64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
d12.aarch64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
d13.x86_64PGDG 0.114PGDG 0.114PGDG 0.114PGDG 0.114N/A
d13.aarch64PGDG 0.114PGDG 0.114PGDG 0.114PGDG 0.114N/A
u22.x86_64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
u22.aarch64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
u24.x86_64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
u24.aarch64PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114PIGSTY 0.114N/A
u26.x86_64PGDG 0.114PGDG 0.114PGDG 0.114PGDG 0.114N/A
u26.aarch64PGDG 0.114PGDG 0.114PGDG 0.114PGDG 0.114N/A

Build

You can build the RPM / DEB packages for documentdb using pig build:

pig build pkg documentdb         # build RPM / DEB packages

Install

You can install documentdb directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:

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

Install the extension using pig or apt/yum/dnf:

pig install documentdb;          # Install for current active PG version
pig ext install -y documentdb -v 18  # PG 18
pig ext install -y documentdb -v 17  # PG 17
pig ext install -y documentdb -v 16  # PG 16
pig ext install -y documentdb -v 15  # PG 15
dnf install -y documentdb_18       # PG 18
dnf install -y documentdb_17       # PG 17
dnf install -y documentdb_16       # PG 16
dnf install -y documentdb_15       # PG 15
apt install -y postgresql-18-documentdb   # PG 18
apt install -y postgresql-17-documentdb   # PG 17
apt install -y postgresql-16-documentdb   # PG 16
apt install -y postgresql-15-documentdb   # PG 15

Preload:

shared_preload_libraries = 'pg_documentdb, pg_documentdb_core';

Create Extension:

CREATE EXTENSION documentdb_core;

Usage

Sources:

documentdb_core is the low-level BSON type and operator layer used by DocumentDB. It is normally installed as a dependency of documentdb; by itself it does not provide collection CRUD, the MongoDB wire protocol, or the gateway.

Configure and Install

pg_documentdb_core must be loaded through shared_preload_libraries, followed by a PostgreSQL restart:

shared_preload_libraries = 'pg_documentdb_core'

For a complete single-node stack, the official helper also preloads pg_cron and pg_documentdb. Install the parent extension in normal deployments:

CREATE EXTENSION documentdb CASCADE;

Direct installation is useful only for low-level BSON work:

CREATE EXTENSION documentdb_core;

The extension is superuser-only and non-relocatable.

BSON Workflow

SELECT '{"name":"Ada","score":42}'::documentdb_core.bson;

SELECT documentdb_core.bson_get_value_text(
  '{"name":"Ada","score":42}'::documentdb_core.bson,
  'name'
);

Use explicit schema qualification unless documentdb_core is in search_path.

Important Objects

  • documentdb_core.bson stores BSON documents.
  • documentdb_core.bsonquery represents BSON query values used by the DocumentDB planner and operator layer.
  • documentdb_core.bsonsequence represents sequences of BSON values.
  • bson_get_value and bson_get_value_text, also exposed through -> and ->>, extract a path from a BSON document.
  • bson_from_bytea, bson_to_bytea, bson_json_to_bson, and bson_to_json_string support serialization boundaries.
  • bson_btree_ops and bson_hash_ops provide comparison and hashing support required by higher layers.

Operational Boundaries

BSON comparison, indexing, and numeric semantics follow DocumentDB’s implementation and should not be assumed to match PostgreSQL jsonb. Most objects are infrastructure for documentdb; applications seeking collections and MongoDB commands should use the parent extension or gateway rather than building directly on internal types.

Version 0.114-0 keeps documentdb_core aligned with the rest of the DocumentDB stack. The upstream changelog does not identify a separate end-user core API migration for this release, so no new standalone workflow is claimed.


Last Modified 2026-07-23: update extension list to 555 (d81fc56)