Change Password

Please enter the password.
Please enter the password. Between 8-64 characters. Not identical to your email address. Contain at least 3 of uppercase, lowercase, numbers, and special characters (such as @*&#).
Please enter the password.
Submit

Change Nickname

Current Nickname:
Submit

v4.2
Search
中文EN
v4.2

    Connection | Configs

    ConnectionPool

    ConnectionPool defines the information of connection pool needed when connecting to an Ultipa graph database.

    Item Type Description
    hosts string[] Ultipa server hosts
    username string username of server
    password string password of server
    crt Buffer crt file path, provided when establishing ssl connection
    defaultConfig ULTIPA.UltipaConfig

    Example: Create a server connection and use graphset 'default'

    import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
    
    let sdkUsage = async () => {
    
      let hosts = [
        "192.168.1.85:60061", 
        "192.168.1.86:60061", 
        "192.168.1.87:60061"
      ];
      let username = "***";
      let password = "***";
      let connPool = new ConnectionPool(hosts, username, password);
      
      let conn = await connPool.getActive();
      let isSuccess = await conn.test();
      console.log(isSuccess);
      
    };
    
    sdkUsage().then(console.log).catch(console.log);
    

    UltipaConfig

    ULTIPA.UltipaConfig defines the information of graphset and etc. needed when connecting to an Ultipa graph database.

    Item Type Description
    graphSetName string name of graphset to use, or use 'default' if not set
    timeout number timeout seconds for any request
    consistency boolean if use leader host to guarantee Consistency Read

    Example: Create a server connection and use graphset 'amz'

    import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
    
    let sdkUsage = async () => {
    
      let hosts = [
        "192.168.1.85:60061", 
        "192.168.1.86:60061", 
        "192.168.1.87:60061"
      ];
      let username = "***";
      let password = "***";
      let connPool = new ConnectionPool(hosts, username, password);
      
      connPool.defaultConfig = { graphSetName: "amz" };
    
      let conn = await connPool.getActive();
      let isSuccess = await conn.test();
      console.log(isSuccess);
      
    };
    
    sdkUsage().then(console.log).catch(console.log);
    

    RequestConfig

    RequestType.RequestConfig defines the information needed when sending non-insert type of requests to an Ultipa graph database.

    Item Type Description
    graphSetName string name of graphset to use, or use graphSetName configured when establishing server connection if not set
    timeout number timeout seconds for the request
    useHost string send the request to a designated host, or sent to a random host if not set
    useMaster boolean if send the request to the leader to guarantee Consistency Read
    retry object retry config when request fails
    stream Stream if return stream
    threadNum number number of thread
    clusterId string cluster ID

    Example: Use graphset 'default' when establishing server connection, use graphset 'amz' when sending UQL to the the leader

    import { ConnectionPool, RequestType } from "@ultipa-graph/ultipa-node-sdk";
    
    let sdkUsage = async () => {
    
      let hosts = [
        "192.168.1.85:60061", 
        "192.168.1.86:60061", 
        "192.168.1.87:60061"
      ];
      let username = "***";
      let password = "***";
      let connPool = new ConnectionPool(hosts, username, password);
    
      let conn = await connPool.getActive();
      let isSuccess = await conn.test();
      console.log(isSuccess);
      
      let requestConfig = <RequestType.RequestConfig>{
        graphSetName: "amz",
        useMaster: true,
      };
      
      let uqlResult = await conn.uql(`find().nodes([1]) as n return n.name`, requestConfig);
      console.log(uqlResult.data?.alias("n.name").asAttrs());  
      
    };
    
    sdkUsage().then(console.log).catch(console.log);
    

    InsertRequestConfig

    RequestType.InsertRequestConfig defines the information needed when sending insert type of requests to an Ultipa graph database.

    Item Type Description
    graphSetName string name of graphset to use, or use graphSetName configured when establishing server connection if not set
    timeout number timeout seconds for the request
    useHost string send the request to a designated host, or sent to a random host if not set
    useMaster boolean if send the request to the leader to guarantee Consistency Read
    retry object retry config when request fails
    stream Stream if return stream
    threadNum number number of thread
    clusterId string cluster ID
    insertType ULTIPA.InsertType insert mode (INSERT_TYPE_NORMAL, INSERT_TYPE_UPSERT, INSERT_TYPE_OVERWRITE)
    createNodeIfNotExist boolean if create start/end nodes of edge when the end nodes do not exist in the graphset

    Example: Create a server connection using graphset 'default', and insert nodes into graphset 'test' under overwrite mode

    import { ConnectionPool, RequestType, ULTIPA } from "@ultipa-graph/ultipa-node-sdk";
    
    let sdkUsage = async () => {
    
      let hosts = [
        "192.168.1.85:60061", 
        "192.168.1.86:60061", 
        "192.168.1.87:60061"
      ];
      let username = "***";
      let password = "***";
      let connPool = new ConnectionPool(hosts, username, password);
    
      let conn = await connPool.getActive();
      let isSuccess = await conn.test();
      console.log(isSuccess);
      
      let node1 = new ULTIPA.Node();
      node1.schema = "card";
      node1.id = "ULTIPA8000000000000001";
      node1.values = {balance: Number(3235.2)};
      
      let node2 = new ULTIPA.Node();
      node2.schema = "client";
      node2.id = "ULTIPA800000000000000B";
      node2.values = {level: Number(7)};
    
      let nodes = [node1, node2];
    
      let insertRequestConfig = <RequestType.InsertRequestConfig>{
        graphSetName: "test",
        insertType: ULTIPA.InsertType.INSERT_TYPE_OVERWRITE,
      };
      let uqlResult = await conn.insertNodesBatchAuto(nodes, insertRequestConfig);
    
      console.log(uqlResult.status.code);
      
    };
    
    sdkUsage().then(console.log).catch(console.log);
    
    Please complete the following information to download this book
    *
    公司名称不能为空
    *
    公司邮箱必须填写
    *
    你的名字必须填写
    *
    你的电话必须填写
    *
    你的电话必须填写