mongo-to-sqlite

MongoDB to SQLite Migration Tool

Welcome to the documentation for the MongoDB to SQLite migration tool.

Overview

This tool provides a robust, efficient way to migrate MongoDB databases to SQLite/LibSQL with automatic schema inference and intelligent type mapping. It supports both local SQLite files and Turso cloud databases.

Key Features

Installation

Download the latest release for your platform from the Releases page.

Extract and install:

tar -xzf mongo-to-sqlite-*.tar.gz
sudo mv mongo-to-sqlite /usr/local/bin/

Quick Start

Migrate all collections to a local SQLite file:

mongo-to-sqlite --database mydb --all-tables --output mydb.db

Migrate to Turso cloud:

export TURSO_DATABASE_URL="libsql://your-database.turso.io"
export TURSO_AUTH_TOKEN="your-auth-token"
mongo-to-sqlite --database mydb --all-tables

Documentation Sections

Quick Start

Get up and running in minutes with step-by-step instructions and common usage examples.

Type Mappings

Understand how MongoDB BSON types are converted to SQLite types, including handling of complex nested data.

Common Use Cases

Local Development

mongo-to-sqlite --database dev_app --all-tables --output dev.db

Production Backup

mongo-to-sqlite \
  --mongodb-uri "mongodb+srv://prod-cluster.mongodb.net" \
  --database production \
  --all-tables \
  --output backup-$(date +%Y%m%d).db

Edge Deployment with Turso

export TURSO_DATABASE_URL="libsql://edge-db.turso.io"
export TURSO_AUTH_TOKEN="$TURSO_TOKEN"
mongo-to-sqlite --database app --all-tables

License

This project is licensed under the MIT License.