All Products
Search
Document Center

Create a MongoDB schema

Last Updated: Apr 25, 2019

Procedure

  1. Log on to the DLA console.

  2. In the left-side navigation pane, click Endpoint. In the endpoint list, locate the row that contains the target endpoint and click Log on in DMS in the Actions column. Run the following statement to create a MongoDB schema in DLA:

    1. CREATE DATABASE `mongo_test`WITH DBPROPERTIES (
    2. catalog = 'mongodb',
    3. location = 'mongodb://<your-user-name>:<your-password>@dds-bp1694axxxxxxxx.mongodb.rds.aliyuncs.com:3717,dds-bp1694ayyyyyyyy.mongodb.rds.aliyuncs.com:3717/admin?replicaSet=zzzzz',
    4. database = 'mongo_test',
    5. INSTANCE_ID = 'mongodb_instance_id',
    6. vpc_id = 'vpc-*******'
    7. );

    Description

    • location: indicates the ConnectionStringURI of your MongoDB instance.

      1

    • database: indicates the name of your MongoDB database.

    • INSTANCE_ID: indicates the ID of your MongoDB instance.

      2

    • vpc_id: indicates the ID of the VPC where your MongoDB instance is located.

Next step

Create a MongoDB table and read and write data from and to the table