Developer beta 0.1.0-beta.1 documentation. The build is not available for download yet; these pages describe the beta as built and tested on Linux x86-64.

Migration from MongoDB

holadb migrate mongodb://user:password@host:27017/dbname ./dest [--infer-schema] [--only a,b] [--batch 1000] [--no-resume] [--json]

The built-in MongoDB client speaks OP_MSG with SCRAM-SHA-256 authentication and streams every collection with find / getMore. Documents are not relational, so the mapping is explicit and reported:

Default mapping (one JSON document per row)

Each collection becomes a table with two columns:

Column Type Content
_id TEXT, primary key ObjectId as 24-character hex; other _id types as JSON text
document JSON the whole document as canonical JSON (ObjectId, dates and binary in MongoDB extended-JSON form)

Nothing is lost: the document round-trips. Queries use the JSON column (SELECT document FROM users WHERE _id = $1).

--infer-schema (scalar columns)

The adapter reads the first 1,000 documents (the sample) and creates one column per top-level field whose type is consistent across them:

Inferred HolaDB Note
ObjectId TEXT 24-character hex
int, long BIGINT
double DOUBLE PRECISION
string TEXT
bool BOOLEAN
date TIMESTAMP millisecond precision
binary BYTEA subtype not kept
nested document, array, or a field whose type varies JSON

Fields seen in some documents but not others are nullable; a field first seen after the sample, and anything else not covered by a column, lands in the _extra JSON column so no data is dropped. The report lists every column with its inferred type.

Indexes and other objects

Single-field indexes on top-level fields become HolaDB indexes (unique when unique). Compound, nested-path (address.city), text, geo and TTL indexes are reported as not migrated. Views and system.* collections are skipped and reported.

Counts are verified against the collection; checksums are verified over the canonical document text.