Data guides · Databases and warehouses

Finding and exporting your MongoDB data

Use db.stats() to separate uncompressed dataSize from storageSize and indexSize. Atlas cluster metrics offer a console view of the same storage concepts.

Unit
GB
Category
Databases and warehouses
Updated
October 2026

What it holds

MongoDB retains document collections, including nested fields and BSON-specific types. Index definitions and collection metadata complement the documents, but application deletions determine how much history remains.

Where MongoDB shows the size

  1. Connect through mongosh with dbStats permission on each relevant database.
  2. Run db.adminCommand({listDatabases: 1}).databases.forEach(d => { const s = db.getSiblingDB(d.name).stats(1073741824); print(d.name, s.dataSize, s.storageSize, s.indexSize, s.objects); });
  3. In Atlas, inspect cluster Metrics > DB Storage to compare logical documents with allocated compressed storage.

Plan and admin role. Works on self-managed MongoDB and Atlas. Database statistics need dbStats and suitable database-listing access; Atlas charts need project access. Give the dump account read permissions across the selected databases.

Exporting the full history

  1. Create a compressed BSON archive with mongodump --uri="mongodb+srv://user@cluster0.example.mongodb.net" --readPreference=secondary --gzip --archive=full-dump.gz.
  2. For a full replica-set dump, consider --oplog to capture concurrent changes. Do not combine it with --db, --collection or --query, or run it through mongos.
  3. Use mongoexport --db=app --collection=orders --out=orders.json only when a single-collection JSON exchange is sufficient.

mongodump includes BSON and collection/index definitions, but not physical index contents. JSON/CSV through mongoexport is not a complete backup and can lose BSON type fidelity.

Coordinate sharded exports by stopping the balancer and pausing cross-shard transactions. --oplog is not a sharded-cluster solution.

Queryable Encryption collections cannot be exported with mongodump.

You don't need to run an export to talk to us, and there's no need to clean it first — removing personal data is part of our work.

Know roughly how much MongoDB data the company has? That's enough for a first valuation.

Get your free valuation