Skip to content
DuckDB community extension

mongo

Integrates DuckDB with MongoDB, enabling direct SQL queries and writes over MongoDB collections without ETL

01 / SETUP

Install and load

Run these commands in a Haybarn SQL session. The extension is available from the community repository.

Haybarn 2.0.0 · SQL
INSTALL mongo FROM community;
LOAD mongo FROM community;

Using upstream DuckDB? Follow the maintainer’s installation instructions.

02 / QUERY

Usage example

Attach to MongoDB

SQL
-- Attach to MongoDB
ATTACH 'host=localhost port=27017' AS mongo_db (TYPE MONGO);

-- Query collections with SQL
SELECT * FROM mongo_db.mydb.mycollection LIMIT 10;

-- Load a CSV directly into MongoDB
INSERT INTO mongo_db.mydb.mycollection
SELECT * FROM read_csv('data.csv');

Provided by stephaniewang526. Not yet verified on Haybarn 2.0.0.

Sample data & setup

About this extension

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.

For detailed setup and usage instructions, visit the extension repository.

Project overview from the community descriptor.

Documentation and resources

Project and build details
Repository
stephaniewang526/duckdb-mongo
License
MIT
Maintainers
stephaniewang526
Written in
C++
Build source
ddd29de6116b
Build definition
Community descriptor