mongo_fdw
Overview
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 8700 | mongo_fdw | No | Yes | No | Yes | No | No | - |
| Related | documentdb pg_projection pgbson jsquery pgjq pg_jsonschema jsonschema redis_fdw etcd_fdw rdf_fdw |
|---|
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PGDG | 5.5.3 | 1817161514 | mongo_fdw | - |
| RPM | PGDG | 5.5.3 | 1817161514 | mongo_fdw_$v | - |
| DEB | PIGSTY | 5.5.3 | 1817161514 | postgresql-$v-mongo-fdw | - |
Install
You can install mongo_fdw directly. First, make sure the PGDG repository is added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
Sources: README, REL-5_5_3 release
Create Server
Server Options: address (default 127.0.0.1), port (default 27017), authentication_database, replica_set, read_preference (primary, secondary, primaryPreferred, secondaryPreferred, nearest), ssl (default false), pem_file, pem_pwd, ca_file, ca_dir, crl_file, weak_cert_validation, use_remote_estimate (default false), enable_join_pushdown (default true), enable_aggregate_pushdown (default true), enable_order_by_pushdown (default true).
Create User Mapping
Create Foreign Table
Important: The first column must be _id of type name (MongoDB’s object identifier).
Table Options: database (default test), collection (defaults to table name), enable_join_pushdown, enable_aggregate_pushdown, enable_order_by_pushdown.
CRUD Operations
Pushdown Features
mongo_fdw pushes down WHERE clauses, joins between foreign tables on the same server, aggregate functions, ORDER BY, LIMIT, and OFFSET to MongoDB for efficient query execution. Use the mongo_fdw.enable_join_pushdown, mongo_fdw.enable_aggregate_pushdown, mongo_fdw.enable_order_by_pushdown, and mongo_fdw.log_remote_query GUCs when diagnosing remote plans.
Version Notes
mongo_fdw 5.5.3, released upstream as REL-5_5_3, adds PostgreSQL 18 support, updates bundled mongoc-driver and json-c libraries for MongoDB 8, adds the mongo_fdw.log_remote_query debug GUC, and fixes nested-field, WHERE, ORDER BY, and unsafe join-pushdown cases. Upstream dropped PostgreSQL 12 support in this line.
Notes
- BSON only supports UTF-8; ensure PostgreSQL database uses UTF-8 encoding
- Column names with uppercase letters or dots (for nested documents) require double-quoting
- PostgreSQL limits column names to 63 characters by default
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)