{Event}  MongoDB is going on a world tour! Gather your team and head to your nearest MongoDB.local. Learn more >

How to Connect Tableau with MongoDB

If you’re working to discover patterns, visualize information, and perform analysis on data, there’s no better solution than using MongoDB in conjunction with Tableau. Fortunately, connecting MongoDB Atlas to Tableau has never been easier, using the Tableau Named Connector, seamlessly allowing you to create Tableau visualizations and dashboards to extract insights in your multi-structured data. In this tutorial, you’ll learn how to install the necessary tools, find your federated database connection information, and connect to your federated database instance using Tableau.

Table of contents


To be successful with connecting Tableau to MongoDB, you'll have to meet a few requirements:

To use Tableau with MongoDB, you'll need a federated database instance within MongoDB Atlas. Federated database instances are only available with MongoDB Atlas 5.0 or greater. You can try MongoDB Atlas for free by creating an M0 cluster.

Throughout this article, you’ll see the “sample_analytics” dataset referenced. This dataset can be installed from within the MongoDB Atlas dashboard, but it isn’t a requirement to be successful. More information on the dataset can be found in the documentation.

Methods in connecting Tableau to MongoDB

There are several ways to easily connect Tableau to MongoDB which include the Tableau Named Connector and the Atlas SQL JDBC driver.

Connect Tableau to MongoDB with the Tableau Named Connector

To make use of the Tableau Named Connector, you'll need a few extra files to get Tableau recognizing the connection option.

First, download the MongoDB JDBC Driver and make sure to choose the *.all.jar version from the list. You'll need to move this downloaded file to one of two places depending on your operating system:

  • Windows: C:\Program Files\Tableau\Drivers
  • macOS: ~/Library/Tableau/Drivers

The directory should exist, but if it doesn't, go ahead and create it.

Next, download the Tableau Named Connector, also known as a TACO file. You'll want to move this file to one of two places depending on your operating system:

  • Windows: C:\Program Files\Tableau\Connectors
  • macOS: ~/Library/Tableau/Connectors

Once again, if the directory doesn't exist, go ahead and create it.

You should already have a federated database instance within MongoDB as per the requirements of this tutorial. We need to obtain the connection information for that instance to be used in Tableau.

Within MongoDB Atlas, click the "Data Federation" tab. For the instance you'd like to connect to, click the "Connect" button followed by "Connect using the Atlas SQL Interface" button.

Red highlight around a button which displays connecting using Atlas SQL.

Connecting to Tableau using the Atlas SQL Interface

Take note of the "URI" in the "Tableau Connector" tab, but not the "Database" field. The database that you want to use as part of your connection is within "Configuration" section of your particular federated instance.

Red highlight around a text field which indicates the input necessary to connect to Tableau via the Atlas SQL Interface.

Selecting the URI to connect via the Tableau connector

Open Tableau Desktop or Tableau Server and navigate to the "Connect" menu. Choose "MongoDB Atlas by MongoDB" as your MongoDB Tableau connector option.

When prompted, enter the URI, database, username, and password information associated with the federated database instance within MongoDB Atlas.

Tableau input page for entering necessary information to connect to database.

Entering the necessary credentials to access the database via Tableau

If the connection was successful, you should see your database and collections that exist as part of your federated database instance within Tableau.

Default Tableau dashboard without any visualizations

Tableau dashboard after connecting via Atlas SQL Interface

Exporting MongoDB data as JSON

Perhaps we’d like to export our MongoDB data in order to analyze and make insightful decisions. In that case, use Tableau’s JSON connector to understand the data without any data preparation. This can be done using mongoexport, a CLI-tool that produces a JSON or CSV export of data stored in a MongoDB instance.

To easily use mongoexport and generate a JSON file, we can use the “Command Line Tools” tab of our “Database Deployments” page.

Red highlight of the “Command Line Tools” tab on the database page.

Navigating to the Command Line Tools page

On the “Data Import and Export Tools” section, we can find a template command to produce an export of data stored in a MongoDB instance that we can then analyze using Tableau.

Page with default commands for both mongoimport and mongoexport

Template commands for mongoimport and mongoexport

For example, if we wanted to export the transactions collection in our sample_analytics MongoDB database to a file called export.json

mongoexport --uri mongodb+srv://username:password@database.dmhrr.mongodb.net/sample_analytics --collection transactions --out export.json

Now, with our exported JSON file ready, we can open Tableau’s JSON connector and select our file. Once opened, you can specify the required schema levels to include for analysis.

Schema levels import dashboard.

Tableau prompt for selecting schema levels moving forward after json import

Now, you’ll have an output from Tableau that we can begin to start analyzing and creating visualizations from to make better data-driven decisions.

Table with information about student’s names, scores, and types of work.

Tableau table with information about students and grades

Create a data pipeline

After Tableau has been connected to our Atlas cluster, we are able to see all of our collections from the federated database, and start working with our data to create visualizations. Let’s begin in the “Data Source” homepage of Tableau.

For example, in the sample_analytics database, we’ve got various collections including customers and transactions. We can drag and drop these collections and link them together like so.

As we have created relationships between the customers to transactions as well as Accounts1, we can now go to our worksheet Sheet1 to start creating tables to view our data. In our instance, we can use the Measure Names calculation in the columns field, and the Measure Values calculation in the rows, which will:

  • Provide a count on the total customers and transactions.
  • Sum up the transaction count.
  • Count the number of accounts.

Now, you can create a horizontal bar chart displaying this data, and even use Tableau online to host this data for sharing and presentation purposes.

Tableau worksheet with insights on customers, transactions, and a total sum of transactions.

Tableau worksheet with data visualizations


You just saw how to connect Tableau to MongoDB in order to turn raw data into an understandable format. This can help to seamlessly create the Tableau visualizations and dashboards that will help you extract the insights and hidden value in your multi-structured data.

Want to learn more about what you can do with MongoDB Atlas? Find out here.

Got a question about the MongoDB Tableau connector? Swing by the MongoDB Community Forums!


Does Tableau work with MongoDB?

Yes, you can use MongoDB as a data source for SQL-based analytics and data visualization tools like Tableau.

Is MongoDB good for analytics?

MongoDB offers several powerful analytics benefits, namely because of the flexible schema requirements as a document-based database model.

What is MongoDB best used for?

The best use cases for MongoDB include situations with unstructured data, including e-commerce, content management, game development, and many more uses where document orientation and high performance are key. For more details, check out the dedicated use cases page.

What is MongoDB Enterprise?

MongoDB Enterprise includes additional operational and management features, and a commercial license (warranty and indemnification), as well as access to proactive support and on-demand training.

Can Tableau connect to MongoDB?

Yes, Tableau can connect to MongoDB using the Tableau Named Connector to access and visualize data.

How do I start Mongosqld?

mongosqld is the BI Connector program which connects your MongoDB instance to your BI tool. To start mongosqld from the command line, run the mongosqld executable in the BI Connector program directory with any necessary command line options.