Data Data Partnerships Data Value Estimator Referrals Design Search Lead generation Data guides Blog Get an offer →
Theme
← Company data sourcesData source · Databases and warehouses

How to find and export your MongoDB data for AI training

MongoDB shows how much data you have through db.stats() on each database, where dataSize is the uncompressed size of your documents and the number to report in GB, and on Atlas the same figures appear in the cluster's metrics. The full history is exported with mongodump, which writes one compressed archive and should read from secondaries, while mongoexport gives JSON or CSV of single collections but is not a backup tool. Below, you'll find what MongoDB data is and why AI labs and data vendors buy it, how to read your sizes, what to know before you apply, every export step, and what stays private.

Where the total is
db.stats() dataSize per database; Atlas Metrics tab
Who can run it
A database user allowed to run dbStats
Export tool
mongodump --gzip --archive; mongoexport for one collection
--oplog cannot be used with
--db, --collection or --query; not through mongos

Key takeaways

  • MongoDB has no settings page for size: a developer runs db.stats() on each database, and the total dataSize in GB, leaving out admin, local and config, is the number to report.
  • dataSize measures the documents before compression, while storageSize measures allocated disk space, which is smaller under compression and does not fall when documents are deleted.
  • mongodump with --gzip --archive and --readPreference=secondary writes a complete copy; mongoexport writes JSON or CSV of single collections and is documented as not a backup tool.
  • You don't need to export anything to apply: have your size in GB, years of history and account count ready, and the data vendor anonymizes the records before any AI lab sees them.

01

What is MongoDB data, and why do AI labs and data vendors buy it?

The short answer

MongoDB data is the set of documents that a company's software keeps in a MongoDB database: user profiles, orders with their line items, conversations with their messages and the events around them. AI labs (companies that build and train AI models) and data vendors (companies that anonymize business records and package them for those labs) buy a copy because each document keeps a whole object, with its timestamps, together, so a record reads as a complete history of one thing.

What a MongoDB database records

MongoDB is a database system that stores information as documents, which are self-contained records written in a format similar to JSON. A document can hold nested parts: a user profile with its settings inside it, or an order with every line item inside it. Documents are grouped into collections, and collections live in databases.

A company can run MongoDB on its own servers or buy it as a hosted service called MongoDB Atlas, where MongoDB runs the servers. A group of servers that keep copies of the same data is a replica set, and in it the extra copies are called secondaries.

Why whole documents teach an AI model something

An AI model learns by studying a very large number of examples and finding the patterns in them, and those examples are called training data. A MongoDB document often holds an entire interaction in one place: a conversation with every message and the time it was sent, or an order with each item and each status change. The nesting means the related facts do not have to be pieced together from several tables.

AI labs now want to train AI agents, software that carries out a job step by step, and an agent learns a job from records of that job being done. Our guide AI training data: why AI companies want your company's data explains the mechanism.

How MongoDB fits into a dataset

A MongoDB database is usually one of several sources in a company's dataset, next to email, documents and tickets. Companies are paid $100K to $2M or more per dataset, according to micro1, the data vendor we typically refer companies to. The price covers the whole dataset, not each source on its own, and what your data is worth explains what moves it.

02

Where does MongoDB show how much data you have?

The short answer

MongoDB reports size for each database through db.stats(). The field dataSize gives the size of your documents before compression, and storageSize gives the disk space MongoDB has set aside for them. Add up dataSize across your databases and report the total in gigabytes (GB). On MongoDB Atlas, the same figures appear in the cluster's metrics.

How to read your database sizes

A developer or database administrator (the person who looks after the database) runs the steps below. They use mongosh, MongoDB's command-line shell, and follow the MongoDB manual on the dbStats command.

  1. Connect with mongosh using a database user who may run the dbStats command on every database. The built-in read role on a database includes it, and no paid plan is needed.
  2. Print every database's figures in GB. The scale value 1073741824 makes MongoDB divide the byte counts by that number, and the command lists databases, then asks each one for its statistics:
    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);
    })
    Each line shows the database name, dataSize, storageSize, indexSize and the number of documents (objects). A user without the right to list databases can name each database instead of looping.
  3. Leave out the admin, local and config databases, which MongoDB keeps for its own use, and add the dataSize values of the rest.
  4. On MongoDB Atlas, open the cluster's Metrics tab. The database storage charts show dataSize, the logical size of the uncompressed data, and a separate index size. The metrics you see depend on your Atlas user role and cluster type, according to Atlas's page on available metrics.

What each figure counts

The statistics answer different questions about the same data, and only one of them is the number to report.

What each MongoDB size figure counts
FigureWhat it counts
dataSizeThe uncompressed size of the documents. It falls when documents are deleted. This is the figure to report.
storageSizeDisk space allocated to the documents, including free space inside it. It is smaller than dataSize when compression is on, and it does not fall when documents are deleted.
indexSizeDisk space allocated to indexes, including free index space. Do not add it to dataSize.
objectsThe number of documents in the database.

Why the Atlas disk figure is not your data size

Atlas separates the logical size of your data from physical disk use, which it reports in its Disk Space Used and Disk Space Free charts. Disk figures include indexes, logs and free space, so use dataSize for the number you report and the disk charts as a cross-check. Atlas refreshes database metrics about every 20 minutes by default, so a very recent change may not show yet.

03

What should you know about your MongoDB data before you apply?

The short answer

Have three facts ready: the total dataSize of your production databases in GB, how many years of documents they hold and how many people or accounts the documents describe. They go into the data manifest, the written summary of which sources hold your records, how many years each covers and roughly how much. You don't need to run an export to find them.

The size in GB

Report the summed dataSize in GB, skipping the admin, local and config databases that MongoDB reserves for itself. Use dataSize and not storageSize, because storageSize measures disk allocated, so it can come out smaller from compression and does not shrink when documents are deleted. indexSize is a separate figure and should not be added.

The years of history

Find the oldest document in your main collections. When the _id field is a default ObjectId, which has its creation time built in, a query such as db.orders.find().sort({_id: 1}).limit(1) returns the oldest order, and you read its date from the ObjectId or from a date field.

The number of seats

For a database, the seat count is the number of people or accounts the documents describe, such as the documents in your users or accounts collection. The database users that MongoDB itself uses to log in are not seats.

What you don't need to do first

Applying shares no data with anyone, and you don't need to export or clean anything first. The data vendor anonymizes records before any AI lab sees them, and nothing moves until a lawyer-reviewed license is signed. The application and each later step are laid out in how to sell your company's data.

04

How do you export your full MongoDB history?

The short answer

A developer or database administrator runs MongoDB's mongodump tool against the cluster, reading from secondaries, with mongodump --uri="..." --readPreference=secondary --gzip --archive=full-dump.gz, which writes one compressed archive. For JSON or CSV copies of single collections they use mongoexport, which MongoDB says is not a backup tool.

Dump the whole cluster with mongodump

The mongodump reference describes the tool, which belongs to the free MongoDB Database Tools and runs from the system command line, not from mongosh. The person holding the database login does these steps.

  1. Write the cluster to one compressed archive file. The --readPreference=secondary flag sends the reading to secondary servers, so the main server carries no extra load, and --gzip compresses the archive:
    mongodump --uri="mongodb+srv://user@cluster0.example.mongodb.net" --readPreference=secondary --gzip --archive=full-dump.gz
    Leave the password out of the connection string and let the tool prompt for it, because a password typed on the command line can be seen by other users of the machine.
  2. On a replica set, add --oplog so that writes made while the dump runs are captured and the result reflects one moment in time. Without it, writes during the dump can leave the output inconsistent.
  3. On a sharded cluster (a cluster that splits its data across several groups of servers), connect through mongos, the router, and stop the balancer with sh.stopBalancer() first. Also pause cross-shard transactions and changes to collections while the dump runs. --oplog does nothing through mongos, so a sharded backup follows MongoDB's separate tutorial for sharded dumps.

Export single collections as JSON or CSV

mongoexport writes one collection at a time as JSON, which is the default, or as CSV. For example, this writes the orders collection of the app database to a file:

mongoexport --db=app --collection=orders --out=orders.json

CSV output needs a list of fields, given with --fields or --fieldFile. MongoDB's mongoexport reference states that the tool is not for backing up deployments, and JSON cannot represent every MongoDB data type, so use mongodump for a complete copy.

Which tool to choose

mongodump compared with mongoexport
ToolOutputBest for
mongodumpBSON documents (MongoDB's own binary format) and collection metadata, as a directory or one archive fileA complete copy of databases
mongoexportJSON or CSV, one collection at a timeReadable copies of single collections

What a dump includes and leaves out

mongodump writes the documents, the collection metadata and options, and the index definitions, but not the index data itself. A dump file is therefore smaller than the disk the database occupies. --oplog cannot be combined with --db, --collection or --query, so a point-in-time dump is a full dump of a replica set member. mongodump cannot export collections that use Queryable Encryption or client-side field level encryption, which keep fields encrypted so that even the server cannot read them.

WHAT db.stats() REPORTS The same database, measured DocumentsdataSize, uncompressed Index dataindexSize, apart Free space in the filesIn storageSize Index definitionsNot a size Report dataSize, in GB. WHAT A mongodump FILE HOLDS The same database, exported DocumentsIncluded, as BSON Index dataNot included Free space in the filesNot included Index definitionsIncluded Indexes are rebuilt from definitions.
The same database measured two ways. The statistics count documents, index data and free space, while the dump holds the documents and the index definitions.

How long an export takes

MongoDB publishes no time, because it depends on the database size, the network and the load on the servers. Writing to an archive can improve performance, and reading from secondaries keeps the dump away from the main server.

Sources: MongoDB Manual, dbStats; MongoDB Database Tools, mongodump and mongoexport; MongoDB Atlas, Review Available Metrics. Steps checked against these pages in November 2026.

05

What stays private when MongoDB data is licensed?

The short answer

The company decides which databases and collections leave MongoDB, and the data vendor replaces names and other personal details with consistent stand-ins before an AI lab sees anything. The company keeps ownership of its database, and the license covers defined records for a defined use.

You choose what is in scope

A dump can cover only the databases and collections you name with --db and --collection, which leaves login data and sensitive collections out of the file. Note that these flags cannot be combined with --oplog. The data vendor also deletes records too sensitive to clean safely instead of anonymizing them.

Names are replaced before a lab sees them

Anonymization means replacing every detail that identifies a person or a company, such as a name or an email address, with a stand-in that is the same every time it appears. The documents still link to each other and their dates still run in order, so a lab can learn from them, but they no longer say who anyone is. The diagram shows one order document before and after.

IN MONGODB one order document orderId: 88214 placed 2026-03-04 customer.name: Dana Brooks customer.email: dana@acme.com customer.company: Acme Corp status: refunded 2026-03-06 handledBy: Mike Alvarez Real names, an email and a company. WHAT AN AI LAB RECEIVES the same order document orderId: 88214 placed 2026-03-04 customer.name: Contact 203 customer.email: contact203@example.test customer.company: Client 7 status: refunded 2026-03-06 handledBy: Employee 22 Same order; dates and sequence intact.
The same order in both panels. The customer, the email, the company and the agent are replaced with stand-ins, while the dates and the refund status stay in order.

The method, including what is deleted outright and how you review samples, is in how company data is anonymized for AI training.

Ownership and payment

Licensing gives the buyer limited rights to a copy, while the company keeps ownership of the originals. The terms that matter, such as exclusivity, permitted use and deletion, are covered in data licensing, and a lawyer's review of what may be shared is covered in whether it is legal to sell company data. micro1 pays in full within 30 days of accepting the data, usually as a single payment.

Questions

Frequently asked questions

Why is storageSize smaller than dataSize in MongoDB?

Because the two measure different things. dataSize counts the documents before compression, while storageSize counts the disk space set aside for them, and with WiredTiger compression the stored files take less room than the raw documents do. storageSize also counts free space inside the allocated files.

Should I use mongodump or mongoexport?

mongodump is the right tool for a complete copy. It keeps the documents in MongoDB's own binary format and records the index definitions. mongoexport writes JSON or CSV, can lose type information and is documented as not a backup tool.

Does deleting documents lower the size I report?

It lowers dataSize, which you report, but not storageSize, because the freed space stays allocated to the collection. That is another reason to report dataSize.

Will mongodump slow down our production database?

It adds reading work for as long as it runs. Pointing it at secondaries with --readPreference=secondary keeps that work off the main server, and writing to an archive can improve its speed.

Do I need to export MongoDB before I apply?

No. The application shares no data. You only need your total dataSize in GB, your years of history and your number of accounts, and the db.stats() command gives you the first. The full export is needed later, after you sign the license.

Can I leave out collections that hold sensitive information?

Yes. Naming the databases and collections with --db and --collection keeps everything else out of the dump, so collections that hold credentials or personal details stay behind.

What is MongoDB data worth to AI labs and data vendors?

A database is priced as part of a whole dataset rather than on its own. Companies are paid $100K to $2M or more per dataset, according to micro1, and the price depends on the years of history and how completely the records show each job. What your data is worth explains the factors.

Bottom line

Know what is in MongoDB, then see what it is worth

You don't need to export anything to apply. Apply in two minutes, describe your records on the intro call, and micro1, the data vendor we typically refer companies to, prices the whole dataset and sends an offer 1–2 days later.

Not legal, tax or financial advice. Figures come from micro1's published pages and public reporting as of November 2026.