All Products
Search
Document Center

Dataphin:Create a MongoDB data source

Last Updated:Jun 23, 2026

Create a MongoDB data source to allow Dataphin to read business data from or write data to MongoDB.

Background information

MongoDB is an open-source document database that stores BSON documents (similar to JSON) with dynamic schemas. It supports flexible data models, efficient indexing, data replication and sharding, and easy-to-use APIs, making it suitable for scenarios that require rapid iteration and storage of diverse data formats.

If you use MongoDB, create a MongoDB data source before you import business data from MongoDB to Dataphin or export data from Dataphin to MongoDB. For more information about ApsaraDB for MongoDB, see ApsaraDB for MongoDB-What is ApsaraDB for MongoDB.

Permissions

Only custom global roles with the Create Data Source permission and system roles such as Super Administrator, Data Source Administrator, Domain Architect, and Project Administrator can create data sources.

Procedure

  1. In the top navigation bar of the Dataphin homepage, choose Management Center > Datasource Management.

  2. On the Datasource page, click +Create Data Source.

  3. On the Create Data Source page, select MongoDB in the NoSQL section.

    If you have recently used MongoDB, you can also select MongoDB in the Recently Used section. You can also enter MongoDB keywords in the search box to quickly search for it.

  4. On the Create MongoDB Data Source page, configure the connection parameters.

    1. Configure the basic information of the data source.

      Parameter

      Description

      Datasource Name

      The name must meet the following requirements:

      • It can contain only Chinese characters, letters, digits, underscores (_), and hyphens (-).

      • It cannot exceed 64 characters in length.

      Datasource Code

      After you configure the data source code, you can reference tables in the data source in Flink_SQL tasks by using the format data_source_code.table_name or data_source_code.schema.table_name. To automatically access the data source in the corresponding environment based on the current environment, use the variable format ${data_source_code}.table or ${data_source_code}.schema.table. For more information, see Dataphin data source table development method.

      Important
      • The data source code cannot be modified after it is configured.

      • You can preview data on the object details page in the asset directory and asset checklist only after the data source code is configured.

      • In Flink SQL, only MySQL, Hologres, MaxCompute, Oracle, StarRocks, Hive, SelectDB, and GaussDB data warehouse service (DWS) data sources are currently supported.

      Version

      Supports MongoDB3.2 and MongoDB3.4+ versions.

      Data Source Description

      A brief description of the data source. It cannot exceed 128 characters.

      Data Source Configuration

      Select the data source to configure:

      • If the business data source distinguishes between production and development data sources, select Production + Development Data Source.

      • If the business data source does not distinguish between production and development data sources, select Production Data Source.

      Tag

      You can categorize data sources by using tags. For information about how to create tags, see Manage data source tags.

    2. Configure the connection parameters between the data source and Dataphin.

      If you selected Production + Development Data Source in the previous step, the configuration page displays both production and development data source configuration options. If you selected Production Data Source, only the production data source configuration page is displayed.

      Note

      Typically, production and development data sources should be configured separately to achieve environment isolation and reduce the impact of development on production. However, Dataphin also supports configuring them as the same data source with identical parameter values.

      Parameter

      Description

      JDBC URL

      Supports multi-replica mode and can be configured with multiple addresses. The connection address format is mongodb://host1:port1;host2:port2....

      Note

      The JDBC URL supports the authSource parameter.

      For example, with ApsaraDB for MongoDB, you can view the connection address and port on the instance basic information page in the MongoDB console.

      Login Method

      Supports Username Login and Anonymous Login.

      Username, Password

      If the login method is Username Login, enter the username and password for the MongoDB instance.

  5. Select a Default Resource Group, which is used to run tasks related to the current data source, including database SQL, offline database migration, data preview, and more.

  6. Perform a Connection Test or directly click OK to save and complete the creation of the MongoDB data source.

    Click Connection Test to verify connectivity between the data source and Dataphin. If you directly click OK, the system automatically tests the connection for all selected clusters, but the data source is created even if all clusters fail to connect.

    Test Connection tests the connection for the Default Cluster or Registered Scheduling Clusters that have been registered in Dataphin and are in normal use. The Default Cluster is selected by default and cannot be deselected. If there are no resource groups under a Registered Scheduling Cluster, connection testing is not supported. You need to create a resource group first before testing the connection.

    • The selected clusters are used only to test network connectivity and are not used for running tasks.

    • The test connection usually completes within 2 minutes. If it times out, click the image icon to view the reason and retry.

    • Regardless of the test result (Connection Failed, Connection Successful, or Succeeded With Warning), the system records the timestamp of the final result.

      Note

      Only the test results for the Default Cluster include three connection statuses: Succeeded With Warning, Connection Successful, and Connection Failed. The test results for Registered Scheduling Clusters in Dataphin only include two connection statuses: Connection Successful and Connection Failed.

    • When the test result is Connection Failed, click the image icon to view the failure reason.

    • When the test result is Succeeded With Warning, the application cluster connection succeeded but the scheduling cluster connection failed. The data source cannot be used for data development and integration. Click the image icon to view the log information.