Setup guide · MongoDB

MongoDB in Dataki: a CSV export, or a copy in BigQuery

Two routes bring MongoDB data into Dataki: a CSV export you upload, which takes minutes, or a copy in BigQuery made by Google's Dataflow template, which Dataki then queries like any dataset.

  1. MongoDB
  2. CSV or BigQuery
  3. Dataki
Setup
Five minutes for a CSV export. About 20 for a BigQuery copy.
Cost
An upload is free. A Dataflow job is billed by Google for the time it runs.
Freshness
As fresh as your last export or job run.
Best for
A CSV for one question now. BigQuery for dashboards that should keep working.

01Before you start

  • mongoexport, from the MongoDB Database Tools, for the CSV route.
  • A Google Cloud project with billing, for the BigQuery route.

02Set it up

3 steps, about 5 minutes

  1. 01

    Route one: export a collection to CSV

    CSV needs the fields named. Dot notation reaches into embedded documents:

    Terminal
    mongoexport --uri="mongodb+srv://user:password@cluster.example.net/shop" \
      --collection=orders --type=csv \
      --fields=_id,status,total,createdAt,customer.country \
      --out=orders.csv
    • Upload orders.csv at app.dataki.ai/connect, under files. Dataki loads it into a table and queries it with full SQL.
    • Dataki loads every CSV column as text and casts in SQL, so name the number and date columns in your first question and check the casts in the SQL it shows.
  2. 02

    Route two: copy it into BigQuery

    In the Google Cloud console, open Dataflow › Create job from template and pick MongoDB to BigQuery. Give it the connection URI, the database, the collection and an output table such as your-project:mongo.orders.

    Set the userOption parameter to FLATTEN, which makes each top-level field a column. Left at NONE, each document lands as one JSON string in a source_data column.

    Each run appends to the table, so a second run doubles every document. To refresh the copy, empty the table first with TRUNCATE TABLE mongo.orders, then run the job again.

  3. 03

    Connect the dataset in Dataki

    Open app.dataki.ai/connect and, under Linked Google Cloud Projects, choose Link New Google Project. Sign in with a Google account that can manage IAM in the project holding the data, and pick that project. Dataki creates a service account named Dataki in it with two roles, BigQuery Data Viewer and BigQuery Job User: it can read tables and run queries.

    The project's datasets then appear among your sources. Pick mongo. Each dataset is one source in Dataki, and Team includes three.

03Ask it

Your first questions

Once the data is in, it is a table like any other. For example:

How many orders did each country place last month?

What is the average order value by status?

Once MongoDB is connected, the same questions work from your AI assistant through Dataki's MCP server:

04Worth knowing

Good to know

Both templates are in beta
Google marks the MongoDB to BigQuery templates as beta. For a continuous copy, Google's Datastream also replicates MongoDB 5.0 and later into BigQuery and is generally available, but Google does not yet document how the documents are laid out there.
Dataflow has to reach your database
The job runs on Google's Dataflow workers, which connect to MongoDB themselves. On Atlas, that means allowing the workers' addresses in the IP access list, or giving the job a fixed address through Cloud NAT.
Arrays do not fit in a CSV
An array field exports as its JSON text. Export array elements as a separate collection, or use the BigQuery route, when you need to count them.

Your first month is free

Connect MongoDB. Ask it something.

Once Dataki can read your data, the first answer is one question away. Every answer worth keeping becomes a dashboard with a link that stays live.

Then a plan
Team or Business, once the month from your sign-up ends.
Read-only
Every query runs read-only. Dataki cannot change your data.
No card
No card to sign up, nothing to cancel.