[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-05 (世界標準時間)。"],[],[],null,["# MongoDB Connector for BI\n\n| **Note:** Looker requires at least MongoDB version 4.0+ and MongoDB Connector for BI version 2.6.0+ (where the [`type_conversion_mode`](https://docs.mongodb.com/bi-connector/master/reference/type-conversion/#type-conversion-modes) session variable was introduced).\n\nLooker can access MongoDB using the MongoDB Connector for BI using two options:\n\n- Using the MongoDB Connector for BI in [MongoDB Atlas](https://docs.atlas.mongodb.com/bi-connection/).\n- Using a MongoDB Connector for BI installed on the same server as the MongoDB database.\n\nMongoDB Atlas\n-------------\n\nYour MongoDB Atlas must use an M10+ cluster. For Looker to use a MongoDB database running on MongoDB Atlas, you must use the [MongoDB Connector for BI (MongoBI)](https://docs.atlas.mongodb.com/bi-connection/). Enabling the BI Connector for Atlas requires that MongoDB Atlas use a M10+ cluster.\n\nYou must also create a user account that has read permissions for the desired database.\n\n### Configuring the MongoDB Connector for BI\n\nBefore creating a connection in Looker, your MongoDB or Atlas administrator needs to set up the MongoDB Connector for BI using the following steps, which are explained on this page:\n\n- [Add the Looker server to the Atlas IP access list](#adding-the-server-to-the-atlas-ip-access-list)\n- [Enable the MongoDB Connector for BI](#enabling_the_mongo_connector_for_bi)\n- [Allow use of regular derived tables (recommended)](#allowing_use_of_regular_derived_tables_(recommended))\n\n### Adding the Looker server to the Atlas IP access list\n\nAtlas only allows client connections from entries in the project's IP access list. Add the Looker IP address to the Atlas project's IP access list:\n\n1. [Get the Looker IP address](/looker/docs/enabling-secure-db-access).\n2. Follow the [Atlas IP access list setup](https://docs.atlas.mongodb.com/security/ip-access-list/) instructions to add the Looker IP address to the Atlas IP access list.\n\n### Enabling the MongoDB Connector for BI\n\nEnable the MongoDB Connector for BI:\n\n1. Verify that you are on a [M10+ cluster](https://docs.atlas.mongodb.com/scale-cluster/#a-open-the-editing-cluster-dialog).\n2. In Atlas, [open the Connect page for the cluster](https://docs.atlas.mongodb.com/bi-connection/). Make a note of the hostname, port, and user. You'll need to use that information when configuring the connection in Looker.\n\nMongoDB on the same server\n--------------------------\n\nBefore 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 on this page:\n\n- [Installing the Mongo Connector for BI](#installing_the_mongo_connector_for_bi)\n- [Encrypting network traffic](#encrypting_network_traffic)\n- [Setting up the Looker user and permissions](#setting_up_the_looker_user_and_permissions)\n- [Allowing use of regular derived tables (recommended)](#allowing_use_of_regular_derived_tables_(recommended))\n\n### Installing the Mongo Connector for BI\n\nInstall the MongoDB Connector for BI on the same server as the MongoDB database, as explained on the [Install BI Connector On Premises](https://docs.mongodb.com/bi-connector/master/installation/) MongoDB documentation page.\n\n### Encrypting network traffic\n\nThe MongoDB 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](https://docs.mongodb.com/bi-connector/master/tutorial/ssl-setup/) MongoDB documentation page.\n\n### Setting up the Looker user and permissions\n\nIn the [MongoDB shell](https://docs.mongodb.com/manual/mongo/), enter the `use` command to switch to the database that Looker will connect to. Then, create a user for Looker with [`db.createUser()`](https://docs.mongodb.com/manual/reference/method/db.createUser/) with the role `readWrite`: \n\n use looker_database\n\n db.createUser({ user: looker,\n pwd: `some_password_here`,\n roles: [ \"readWrite\" ]\n })\n\nInstalling the MongoBI JDBC driver files\n----------------------------------------\n\nFor both MongoDB Connector for BI options, Looker requires configuring JDBC driver files by doing the following steps:\n\nDownload these two JAR files:\n\n- [mongosql auth 1.0.0](https://mvnrepository.com/artifact/org.mongodb/mongosql-auth/1.0.0-rc0)\n- [mysql connector java 5.1.47](https://mvnrepository.com/artifact/mysql/mysql-connector-java/5.1.47)\n\nFollow the steps on the [Unpackaged JDBC drivers](/looker/docs/unpackaged-jdbc-drivers) documentation page using the following values:\n\n**driver symbol** : `mongobi`\n\n**driver entry**: \n\n - name: mongobi\n dir_name: mongobi\n module_path: com.mysql.jdbc.Driver\n override_jdbc_url_subprotocol: mysql\n\n**If you are on Looker 6.2 or earlier**: \n\n - name: maria15x\n dir_name: mongobi\n module_path: com.mysql.jdbc.Driver\n override_jdbc_url_subprotocol: mysql\n\nFor the [step to put the driver in your dialect's directory](/looker/docs/unpackaged-jdbc-drivers#driver_directory), the paths to these files will look like this:\n\n- `looker/custom_jdbc_drivers/mongobi/mongosql-auth-1.0.0-rc0.jar`\n- `looker/custom_jdbc_drivers/mongobi/mysql-connector-java-5.1.47.jar`\n\n### Allowing use of regular derived tables (recommended)\n\n[Derived tables](/looker/docs/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, the Looker derived table capability provides a way to create new tables that don't already exist in your database.\n\nThe MongoDB Connector for BI supports temporary [regular derived tables](/looker/docs/derived-tables#regular-or-ephemeral-derived-tables) but does not support [persistent derived tables](/looker/docs/derived-tables#persistent-derived-tables).\n\nSince regular derived tables are temporary, they don't 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.\n\nFollow the Modify MongoDB Users section on this [MongoDB documentation page about configuring database users](https://docs.atlas.mongodb.com/security-add-mongodb-users/#modify-mongodb-users) to add the `dbOwner` role on `looker_tmp` for the user Looker will use to connect. \n\n db.grantRolesToUser(\"looker\", [ {role: \"dbOwner\", db: \"looker_tmp\"} ])\n\n\nCreating the Looker connection to your database\n-----------------------------------------------\n\nFollow these steps to create the connection from Looker to your database:\n\n1. In the **Admin** section of Looker, select **Connections** , and then click **Add Connection**.\n2. Select **MongoBI** from the **Dialect** drop-down menu.\n\n | **Note:** If you are on a [Looker (Google Cloud core)](/looker/docs/looker-core-overview) instance and you don't see your dialect listed in the **Dialect** drop-down menu, see the [Looker (Google Cloud core) documentation](/looker/docs/looker-core-dialects#supported_dialects_for) to verify that the dialect is supported for Looker (Google Cloud core) instances.\n3. Fill out the connection details. The majority of the settings are common to most database dialects. See the [Connecting Looker to your database](/looker/docs/connecting-to-your-db) documentation page for information.\n\n4. To verify that the connection is successful, click **Test** . See the [Testing database connectivity](/looker/docs/testing-db-connectivity) documentation page for troubleshooting information.\n\n5. To save these settings, click **Connect**.\n\nUsing SQL functions and operators with MongoDB Connector for BI\n---------------------------------------------------------------\n\nWhen developing using a MongoDB Connector for BI connection, you can use the [SQL functions and operators listed in the MongoDB documentation](https://docs.mongodb.com/bi-connector/master/supported-operations/).\n\nFeature support\n---------------\n\nFor Looker to support some features, your database dialect must also support them.\n\nMongoBI supports the following features as of Looker 25.14:\n\nIn addition:\n\n- MongoDB does not support [millisecond and microsecond timeframes for dimension groups](/looker/docs/reference/param-field-dimension-group#timeframe_options).\n- MongoDB does not support [millisecond, millisecondX, and microsecond types for dimensions](/looker/docs/reference/param-dimension-filter-parameter-types#time).\n- Looker treats all timestamps accessed from MongoBI as being in the coordinated universal time (UTC) time zone."]]