Integrates DuckDB with MongoDB, enabling direct SQL queries over MongoDB collections without exporting data or ETL
Maintainer(s):
stephaniewang526
Installing and Loading
INSTALL mongo FROM community;
LOAD mongo;
Example
-- Attach to MongoDB
ATTACH 'host=localhost port=27017' AS mongo_db (TYPE MONGO);
-- Query your collections
SELECT * FROM mongo_db.mydb.mycollection LIMIT 10;
About mongo
The duckdb-mongo extension provides direct SQL access to MongoDB collections without requiring data export or ETL processes. It supports both standalone MongoDB instances and MongoDB Atlas clusters, with automatic schema inference and filter pushdown for efficient querying. The extension enables you to run analytical SQL queries directly against MongoDB data, including joins, aggregations, and complex analytical operations.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| mongo_clear_cache | table | Clears the schema cache for all attached MongoDB databases. Useful when MongoDB schema changes. | NULL | [SELECT * FROM mongo_clear_cache()] |
| mongo_scan | table | Scans a MongoDB collection and returns its contents as a table. Supports optional filter and sample_size parameters. | NULL | [SELECT * FROM mongo_scan('mongodb://localhost:27017', 'mydb', 'mycollection'), SELECT * FROM mongo_scan('mongodb://localhost:27017', 'mydb', 'mycollection', filter := '{"status": "active"}')] |