There are several ways Looker can use Mongo Connector for BI (MongoBI) to access MongoDB:
- Using a Mongo Connector for BI installed on the same server as the MongoDB database. This page discusses how to configure MongoDB and the connector on the same server.
- Using the Mongo Connector for BI in MongoDB Atlas.
Configuring Looker to Use a Custom JDBC
Looker uses Mongo’s authentication plugin, so you must update Mongo’s driver to the custom JDBC by doing the following steps:
- Create the directory
- Download these two JAR files into the
- In the
~/looker/directory, create a
custom_jdbc_config.ymlfile (if it does not already exist):
- Add the following to the
custom_jdbc_config.ymlfile to tell Looker to use the new driver:
- Only if you are on Looker 6.2 or below, add the following
maria15xentry to the
custom_jdbc_config.ymlfile. (Do not add this entry if you are on Looker 6.4 or above.)
When you upgrade to Looker 6.4 or above, you must delete the
maria15xentry as part of your upgrade.
- In the
~/looker/directory, create a
lookerstart.cfgfile (if it does not already exist):
- In the
--use-custom-jdbc-configto the end of the list of
LOOKERARGSenvironment variables. Leave all other arguments in the list, if there are any. In this example, there are existing arguments
--port 8080, so we will add
--use-custom-jdbc-configto the end, inside the quotes:
- Restart Looker:
Configuring the Mongo Connector for BI
Before creating a connection in Looker, your MongoDB administrator should set up MongoDB and the Mongo Connector for BI using the following steps, which are explained below:
- Installing the Mongo Connector for BI
- Encrypting network traffic
- Setting up the Looker user and permissions
- Allowing use of regular derived tables (recommended)
Installing the Mongo Connector for BI
To use Looker, you must be running MongoDB 4.0 (or later) and the Mongo Connector for BI 2.6.1 (or later).
Install the Mongo Connector for BI on the same server as the MongoDB database, as explained on the Install BI Connector On Premises MongoDB documentation page.
Encrypting Network Traffic
The Mongo Connector for BI requires using SSL encryption between MongoDB’s server and the Looker application. Follow the SSL setup instructions on the Configure SSL for BI Connector MongoDB documentation page.
Setting Up the Looker User and Permissions
In the MongoDB shell, create a user for Looker with the role
- Specify the database that you want Looker to access:
- Create a new user, typically called
looker, and give it
readWriteAnyDatabasepermission. In the following example, change
some_password_hereto a unique, secure password:
Allowing Use of Regular Derived Tables (Recommended)
Derived tables are important tools in Looker that enable you to expand the sophistication of your analyses. They can also play a valuable role in enhancing query performance. At a high level, Looker’s derived table functionality provides a way to create new tables that don’t already exist in your database.
The Mongo Connector for BI supports temporary regular derived tables but does not yet support persistent derived tables.
Since regular derived tables are temporary, they do not need to be stored. Thus, you don’t need to create a schema for them. However, you need to grant the
dbOwner role to
looker_tmp schema, even if that schema does not exist.
Connecting Looker to Mongo
Configure a database connection via the Looker interface. From the Admin section, select Connections then New Connection. See the Connecting Looker to Your Database documentation page for more information.
Click on Test These Settings to verify the connection is successful. The Testing Database Connectivity documentation page has troubleshooting information.
Using SQL Functions and Operators with MongoDB Connector for BI
When developing using a MongoDB Connector for BI connection, you can use the SQL functions and operators listed on this MongoDB documentation page.
Looker’s ability to provide some features depends on whether the database dialect can support them.
In the current Looker release, MongoDB supports the following Looker features:
MongoBI connections also do not support:
- list_type, median, median_distinct, percentile, and percentile_distinct measure types.
- Millisecond and microsecond timeframes for dimension groups
- Millisecond, millisecondX, and microsecond types for dimensions
In addition, Looker treats all timestamps accessed from MongoBI as being in the coordinated universal time (UTC) time zone.
After completing the database configuration, you can connect to the database from Looker using these directions.