documentdb_core
documentdb : Core API surface for DocumentDB for PostgreSQL
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 9010 | documentdb_core
|
documentdb
|
0.109 |
SIM
|
MIT
|
C
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--sLd--
|
No
|
Yes
|
Yes
|
Yes
|
no
|
no
|
| Relationships | |
|---|---|
| Need By | documentdb
documentdb_distributed
|
| See Also | mongo_fdw
rum
pg_jsonschema
jsquery
pg_cron
postgis
vector
|
| Siblings | documentdb
documentdb_distributed
documentdb_extended_rum
|
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY
|
0.109 |
18
17
16
15
14
|
documentdb |
- |
| RPM | PIGSTY
|
0.109 |
18
17
16
15
14
|
documentdb_$v |
postgresql$v-contrib, pg_cron_$v, pgvector_$v, rum_$v |
| DEB | PIGSTY
|
0.109 |
18
17
16
15
14
|
postgresql-$v-documentdb |
postgresql-$v-cron, postgresql-$v-pgvector, postgresql-$v-rum |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.107
|
MISS
|
el8.aarch64
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.107
|
MISS
|
el9.x86_64
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.107
|
MISS
|
el9.aarch64
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.107
|
MISS
|
el10.x86_64
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.107
|
MISS
|
el10.aarch64
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.107
|
MISS
|
d12.x86_64
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
MISS
|
d12.aarch64
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
MISS
|
d13.x86_64
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
MISS
|
d13.aarch64
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
MISS
|
u22.x86_64
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
MISS
|
u22.aarch64
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
MISS
|
u24.x86_64
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
MISS
|
u24.aarch64
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
PIGSTY 0.109
|
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_core; # install by extension name, for the current active PG version
pig install documentdb_core -v 18; # install for PG 18
pig install documentdb_core -v 17; # install for PG 17
pig install documentdb_core -v 16; # install for PG 16
pig install documentdb_core -v 15; # install for PG 15Config this extension to shared_preload_libraries:
shared_preload_libraries = 'pg_documentdb, pg_documentdb_core';Create this extension with:
CREATE EXTENSION documentdb_core;Usage
documentdb_core: Core API surface for DocumentDB for PostgreSQL
DocumentDB provides MongoDB-compatible document database functionality built on PostgreSQL. The documentdb_core extension introduces BSON datatype support and operations for native Postgres.
BSON Data Type
The extension adds a native BSON (Binary JSON) data type to PostgreSQL, enabling storage and manipulation of MongoDB-style documents.
Basic Document Operations
Documents are managed through MongoDB-compatible CRUD operations via the DocumentDB API layer:
import pymongo
client = pymongo.MongoClient(
'mongodb://user:pass@localhost:10260/?tls=true&tlsAllowInvalidCertificates=true'
)
db = client["myDatabase"]
collection = db.create_collection("myCollection")
# Insert documents
collection.insert_one({
'name': 'John Doe',
'email': '[email protected]',
'address': '123 Main St'
})
collection.insert_many([
{'name': 'Jane Smith', 'email': '[email protected]'},
{'name': 'Alice Johnson', 'email': '[email protected]'}
])
# Query documents
for doc in collection.find():
print(doc)
single = collection.find_one({'name': 'John Doe'})Aggregation Pipelines
pipeline = [
{'$match': {'name': 'Alice Johnson'}},
{'$project': {'_id': 0, 'name': 1, 'email': 1}}
]
results = collection.aggregate(pipeline)
for doc in results:
print(doc)Components
- documentdb_core: BSON datatype support and operations for native Postgres
- documentdb (pg_documentdb): Public API surface providing CRUD functionality
- pg_documentdb_gw: Gateway protocol translation layer (MongoDB wire protocol to PostgreSQL)
The extension supports full-text search, geospatial queries, and vector search on BSON documents.