documentdb
概览
| 扩展包名 | 版本 | 分类 | 许可证 | 语言 |
|---|---|---|---|---|
documentdb | 0.113 | SIM | MIT | C |
| ID | 扩展名 | Bin | Lib | Load | Create | Trust | Reloc | 模式 |
|---|---|---|---|---|---|---|---|---|
| 9000 | documentdb | 否 | 是 | 是 | 是 | 否 | 否 | - |
| 9010 | documentdb_core | 否 | 是 | 是 | 是 | 否 | 否 | - |
| 9020 | documentdb_distributed | 否 | 是 | 是 | 是 | 否 | 否 | - |
| 9030 | documentdb_extended_rum | 否 | 是 | 是 | 是 | 否 | 是 | - |
| 相关扩展 | documentdb_core pg_cron postgis tsm_system_rows vector mongo_fdw wal2mongo pg_jsonschema jsquery |
|---|---|
| 下游依赖 | documentdb_distributed documentdb_extended_rum |
版本
| 类型 | 仓库 | 版本 | PG 大版本 | 包名 | 依赖 |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.113 | 1817161514 | documentdb | documentdb_core, pg_cron, postgis, tsm_system_rows, vector |
| RPM | PIGSTY | 0.113 | 1817161514 | documentdb_$v | postgresql$v-contrib, pg_cron_$v, pgvector_$v, rum_$v, postgis36_$v |
| DEB | PIGSTY | 0.113 | 1817161514 | postgresql-$v-documentdb | postgresql-$v-cron, postgresql-$v-pgvector, postgresql-$v-rum, postgresql-$v-postgis-3 |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 0.113 el8.x86_64.pg18 : documentdb_18 documentdb_18-0.113-0PIGSTY.el8.x86_64.rpm
| PIGSTY 0.113 el8.x86_64.pg17 : documentdb_17 documentdb_17-0.113-0PIGSTY.el8.x86_64.rpm
| PIGSTY 0.113 el8.x86_64.pg16 : documentdb_16 documentdb_16-0.113-0PIGSTY.el8.x86_64.rpm
| PIGSTY 0.113 el8.x86_64.pg15 : documentdb_15 documentdb_15-0.113-0PIGSTY.el8.x86_64.rpm
| PIGSTY MISS |
| el8.aarch64 | PIGSTY 0.113 el8.aarch64.pg18 : documentdb_18 documentdb_18-0.113-0PIGSTY.el8.aarch64.rpm
| PIGSTY 0.113 el8.aarch64.pg17 : documentdb_17 documentdb_17-0.113-0PIGSTY.el8.aarch64.rpm
| PIGSTY 0.113 el8.aarch64.pg16 : documentdb_16 documentdb_16-0.113-0PIGSTY.el8.aarch64.rpm
| PIGSTY 0.113 el8.aarch64.pg15 : documentdb_15 documentdb_15-0.113-0PIGSTY.el8.aarch64.rpm
| PIGSTY MISS |
| el9.x86_64 | PIGSTY 0.113 el9.x86_64.pg18 : documentdb_18 documentdb_18-0.113-0PIGSTY.el9.x86_64.rpm
| PIGSTY 0.113 el9.x86_64.pg17 : documentdb_17 documentdb_17-0.113-0PIGSTY.el9.x86_64.rpm
| PIGSTY 0.113 el9.x86_64.pg16 : documentdb_16 documentdb_16-0.113-0PIGSTY.el9.x86_64.rpm
| PIGSTY 0.113 el9.x86_64.pg15 : documentdb_15 documentdb_15-0.113-0PIGSTY.el9.x86_64.rpm
| PIGSTY MISS |
| el9.aarch64 | PIGSTY 0.113 el9.aarch64.pg18 : documentdb_18 documentdb_18-0.113-0PIGSTY.el9.aarch64.rpm
| PIGSTY 0.113 el9.aarch64.pg17 : documentdb_17 documentdb_17-0.113-0PIGSTY.el9.aarch64.rpm
| PIGSTY 0.113 el9.aarch64.pg16 : documentdb_16 documentdb_16-0.113-0PIGSTY.el9.aarch64.rpm
| PIGSTY 0.113 el9.aarch64.pg15 : documentdb_15 documentdb_15-0.113-0PIGSTY.el9.aarch64.rpm
| PIGSTY MISS |
| el10.x86_64 | PIGSTY 0.113 el10.x86_64.pg18 : documentdb_18 documentdb_18-0.113-0PIGSTY.el10.x86_64.rpm
| PIGSTY 0.113 el10.x86_64.pg17 : documentdb_17 documentdb_17-0.113-0PIGSTY.el10.x86_64.rpm
| PIGSTY 0.113 el10.x86_64.pg16 : documentdb_16 documentdb_16-0.113-0PIGSTY.el10.x86_64.rpm
| PIGSTY 0.113 el10.x86_64.pg15 : documentdb_15 documentdb_15-0.113-0PIGSTY.el10.x86_64.rpm
| PIGSTY MISS |
| el10.aarch64 | PIGSTY 0.113 el10.aarch64.pg18 : documentdb_18 documentdb_18-0.113-0PIGSTY.el10.aarch64.rpm
| PIGSTY 0.113 el10.aarch64.pg17 : documentdb_17 documentdb_17-0.113-0PIGSTY.el10.aarch64.rpm
| PIGSTY 0.113 el10.aarch64.pg16 : documentdb_16 documentdb_16-0.113-0PIGSTY.el10.aarch64.rpm
| PIGSTY 0.113 el10.aarch64.pg15 : documentdb_15 documentdb_15-0.113-0PIGSTY.el10.aarch64.rpm
| PIGSTY MISS |
| d12.x86_64 | PIGSTY 0.113 d12.x86_64.pg18 : postgresql-18-documentdb postgresql-18-documentdb_0.113-0PIGSTY~bookworm_amd64.deb
| PIGSTY 0.113 d12.x86_64.pg17 : postgresql-17-documentdb postgresql-17-documentdb_0.113-0PIGSTY~bookworm_amd64.deb
| PIGSTY 0.113 d12.x86_64.pg16 : postgresql-16-documentdb postgresql-16-documentdb_0.113-0PIGSTY~bookworm_amd64.deb
| PIGSTY 0.113 d12.x86_64.pg15 : postgresql-15-documentdb postgresql-15-documentdb_0.113-0PIGSTY~bookworm_amd64.deb
| PIGSTY MISS |
| d12.aarch64 | PIGSTY 0.113 d12.aarch64.pg18 : postgresql-18-documentdb postgresql-18-documentdb_0.113-0PIGSTY~bookworm_arm64.deb
| PIGSTY 0.113 d12.aarch64.pg17 : postgresql-17-documentdb postgresql-17-documentdb_0.113-0PIGSTY~bookworm_arm64.deb
| PIGSTY 0.113 d12.aarch64.pg16 : postgresql-16-documentdb postgresql-16-documentdb_0.113-0PIGSTY~bookworm_arm64.deb
| PIGSTY 0.113 d12.aarch64.pg15 : postgresql-15-documentdb postgresql-15-documentdb_0.113-0PIGSTY~bookworm_arm64.deb
| PIGSTY MISS |
| d13.x86_64 | PGDG 0.113 | PGDG 0.113 | PGDG 0.113 | PGDG 0.113 | PIGSTY MISS |
| d13.aarch64 | PGDG 0.113 | PGDG 0.113 | PGDG 0.113 | PGDG 0.113 | PIGSTY MISS |
| u22.x86_64 | PIGSTY 0.113 u22.x86_64.pg18 : postgresql-18-documentdb postgresql-18-documentdb_0.113-0PIGSTY~jammy_amd64.deb
| PIGSTY 0.113 u22.x86_64.pg17 : postgresql-17-documentdb postgresql-17-documentdb_0.113-0PIGSTY~jammy_amd64.deb
| PIGSTY 0.113 u22.x86_64.pg16 : postgresql-16-documentdb postgresql-16-documentdb_0.113-0PIGSTY~jammy_amd64.deb
| PIGSTY 0.113 u22.x86_64.pg15 : postgresql-15-documentdb postgresql-15-documentdb_0.113-0PIGSTY~jammy_amd64.deb
| PIGSTY MISS |
| u22.aarch64 | PIGSTY 0.113 u22.aarch64.pg18 : postgresql-18-documentdb postgresql-18-documentdb_0.113-0PIGSTY~jammy_arm64.deb
| PIGSTY 0.113 u22.aarch64.pg17 : postgresql-17-documentdb postgresql-17-documentdb_0.113-0PIGSTY~jammy_arm64.deb
| PIGSTY 0.113 u22.aarch64.pg16 : postgresql-16-documentdb postgresql-16-documentdb_0.113-0PIGSTY~jammy_arm64.deb
| PIGSTY 0.113 u22.aarch64.pg15 : postgresql-15-documentdb postgresql-15-documentdb_0.113-0PIGSTY~jammy_arm64.deb
| PIGSTY MISS |
| u24.x86_64 | PIGSTY 0.113 u24.x86_64.pg18 : postgresql-18-documentdb postgresql-18-documentdb_0.113-0PIGSTY~noble_amd64.deb
| PIGSTY 0.113 u24.x86_64.pg17 : postgresql-17-documentdb postgresql-17-documentdb_0.113-0PIGSTY~noble_amd64.deb
| PIGSTY 0.113 u24.x86_64.pg16 : postgresql-16-documentdb postgresql-16-documentdb_0.113-0PIGSTY~noble_amd64.deb
| PIGSTY 0.113 u24.x86_64.pg15 : postgresql-15-documentdb postgresql-15-documentdb_0.113-0PIGSTY~noble_amd64.deb
| PIGSTY MISS |
| u24.aarch64 | PIGSTY 0.113 u24.aarch64.pg18 : postgresql-18-documentdb postgresql-18-documentdb_0.113-0PIGSTY~noble_arm64.deb
| PIGSTY 0.113 u24.aarch64.pg17 : postgresql-17-documentdb postgresql-17-documentdb_0.113-0PIGSTY~noble_arm64.deb
| PIGSTY 0.113 u24.aarch64.pg16 : postgresql-16-documentdb postgresql-16-documentdb_0.113-0PIGSTY~noble_arm64.deb
| PIGSTY 0.113 u24.aarch64.pg15 : postgresql-15-documentdb postgresql-15-documentdb_0.113-0PIGSTY~noble_arm64.deb
| PIGSTY MISS |
| u26.x86_64 | PIGSTY MISS | ||||
| u26.aarch64 | PIGSTY MISS |
构建
您可以使用 pig build 命令构建 documentdb 扩展的 RPM / DEB 包:
pig build pkg documentdb # 构建 RPM / DEB 包
安装
您可以直接安装 documentdb 扩展包的预置二进制包,首先确保 PGDG 和 PIGSTY 仓库已经添加并启用:
pig repo add pgsql -u # 添加仓库并更新缓存
使用 pig 或者是 apt/yum/dnf 安装扩展:
pig install documentdb; # 当前活跃 PG 版本安装
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
预加载配置:
shared_preload_libraries = 'pg_documentdb, pg_documentdb_core, pg_cron';
创建扩展:
CREATE EXTENSION documentdb CASCADE; -- 依赖: documentdb_core, pg_cron, postgis, tsm_system_rows, vector
用法
来源:README、CHANGELOG、documentdb.control、documentdb_core.control、documentdb_extended_rum.control
documentdb 是以 PostgreSQL 扩展实现的 MongoDB 兼容文档数据库。它在 PostgreSQL 中加入 BSON 存储和 API,并可通过可选 gateway 层服务 MongoDB wire-protocol 客户端。FerretDB 2.0+ 可以使用 DocumentDB 作为后端。
组件
公开扩展接口拆分为多个相关扩展:
documentdb_core:BSON 数据类型与底层 BSON 操作。documentdb:面向文档 CRUD 与查询行为的公开 API。documentdb_extended_rum:DocumentDB 索引使用的 extended RUM access method。pg_documentdb_gw:本地 Docker 镜像和 MongoDB 兼容客户端使用的 gateway protocol layer。
在需要 API 的每个数据库中安装 SQL 扩展:
CREATE EXTENSION IF NOT EXISTS documentdb CASCADE;
0.113-0 的 documentdb.control 声明依赖 documentdb_core、pg_cron、tsm_system_rows、vector 和 postgis。gateway container 监听 MongoDB 兼容端口;README 示例使用 10260,避免与本机 MongoDB 服务冲突。
MongoDB 客户端示例
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": "alice@example.com"})
print(coll.find_one({"name": "Alice"}))
上游 README 也展示了通过普通 MongoDB driver 执行 aggregation pipeline:
pipeline = [
{"$match": {"name": "Alice"}},
{"$project": {"_id": 0, "name": 1, "email": 1}},
]
for doc in coll.aggregate(pipeline):
print(doc)
版本说明
本项目 CSV 跟踪 DocumentDB 0.113,覆盖 PostgreSQL 15-18。上游 tag 为 v0.113-0;control files 报告 default_version = '0.113-0'。
0.111 到 0.113 的 changelog 主要是 query planner、collation 与 index correctness 方面的工作:
0.113-0为带$in和$nin的非唯一 ordered indexes 增加 opt-in collation support,并在 feature flag 后支持清理 ordered TTL indexes 上的 dead index entries。0.112-0移除较旧的 composite-returningbson_update_documentUDF 路径,扩展非唯一 ordered-index collation support,并改进$group和 accumulator 执行。0.111-0增加后台初始化 job infrastructure、更多$group校验、collation/index pushdown 改进,以及多个 crash fix。
注意事项
- DocumentDB 是多扩展栈;
CREATE EXTENSION documentdb CASCADE是通常入口,但如果需要 MongoDB wire compatibility,实际部署还需要 gateway/runtime pieces。 - changelog 中部分功能受
documentdb.*feature flags 控制。将行为写成 always-on 前,先核对确切安装版本中的 flag 默认值。 documentdb_extended_rum可 relocation,但documentdb和documentdb_core不可 relocation。