{
  "synLogic": "int $ret \u003d $api($1, $2, $3, $4, $5, $6);",
  "help": "",
  "notes": "Here no actual connection is made, it just stores all the input into mongodb object and hence no packet can be captured during this.\nArguments Notes: \r\n1. ip  \r\n\t- Provides MongoDB server IP. \r\n\t- If IP is not provided (i.e. NULL) then ‘localhost’ is taken as MongoDB server ip. \r\n\t- IP must be in format ‘xxx.xxx.xxx.xxx’ . Eg: 10.10.70.4\r\n\t- It can be parameterised. \r\n2. port \r\n\t- Provides MongoDB server port.\r\n\t- If port is not provided (i.e \u003c 0) then ‘27017’ takes as MongoDB server port.\r\n\t- Port must be a valid port number.\r\n\t- It can be parameterised.\r\n3. auth_type\r\n\t- Provide authentication \r\n\t- Following authentication is supported by NS for Mongo Protocol\r\n\t\ta. Basics - for this type 0 and macro AUTH_BASICS\r\n\t\tb. Kerberos - for this type 1 and macro AUTH_KERBEROS\r\n\t\tc. SSL - for this type 2 and macro AUTH_SSL\r\n\t\td. SASL Plain - for this type is 3 and macro AUTH_SASL\r\n\t- It can be parameterised. ",
  "returns": "This api returns '0' on success and '-1' on failure.",
  "arguments": "\u003ctable class\u003d\"newGuiTable\"  style\u003d\"width:100%\" \u003e \u003ctr\u003e \u003cth\u003e Argument \u003c/th\u003e \u003cth\u003e Description \u003c/th\u003e \u003c/tr\u003e 	\u003ctr\u003e \u003ctd\u003e IP \u003c/td\u003e \u003ctd\u003e A string that represents the IP address of the MongoDB server. \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Port \u003c/td\u003e \u003ctd\u003e An integer that specifies the port number of the MongoDB server \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Authentication Type \u003c/td\u003e \u003ctd\u003e A short integer that specifies the type of authentication to be used when connecting to the MongoDB server. The following authentication types are supported:<br />Basics (0) - macro: AUTH_BASICS<br />Kerberos (1) - macro: AUTH_KERBEROS<br />SSL (2) - macro: AUTH_SSL<br />SASL Plain (3) - macro: AUTH_SASL \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e User Name \u003c/td\u003e \u003ctd\u003e A string that specifies the username to be used for authentication \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd\u003e Password \u003c/td\u003e  \u003ctd\u003e A string that specifies the password to be used for authentication \u003c/td\u003e \u003c/tr\u003e \u003c/table\u003e",
  "parameterization": "ip and port can be parameterised",
  "name": "ns_mongodb_connect",
  "syntax": "int ns_mongodb_connect( char *ip, int port, short auth_type, char *user, char *pass, char *dbname)",
  "javaSyntax": "",
  "cEx": "flow()\n{\n  char *ip = \"127.0.0.1\"; // IP address of the MongoDB server\n  int port = 27017; // Port number of the MongoDB server\n  short auth_type = 0; // Authentication type\n  char *user = \"my_username\"; // Username\n  char *pass = \"my_password\"; // Password\n  char *dbname = \"my_db\"; // Database name\n\n  // Connect to MongoDB server\n  int ret = ns_mongodb_connect(ip, port, auth_type, user, pass, dbname);\n\n  if(ret == 0) {\n     printf(\"Connected to MongoDB server successfully!\");\n  } else {\n    printf(\"Failed to connect to MongoDB server.\");\n  }\n}",
  "javaEx": "",
  "insertStrC": "ns_mongodb_connect( char *ip, int port, short auth_type, char *user, char *pass, char *dbname);",
  "insertStrJava": "",
  "description": "The ns_mongodb_connect API is used for connecting to MongoDB server.",
   "component": [
    {
      "id": "$1",
      "type": "TextField",
      "label": "IP",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter IP",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "",
      "argIndex": 0,
      "validate": {
        "inputType": "Text",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 0
     }
   },
     {
      "id": "$2",
      "type": "TextField",
      "label": "Port",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter port",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "",
      "argIndex": 0,
      "validate": {
        "inputType": "Number",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 2147483647,
        "method": ""
      }
    },
    {
      "id": "$3",
      "type": "Dropdown",
      "label": "Authentication Type",
      "value":AUTH_BASIC,
      "css": "p-grid p-align-center w-100-p",
      "title": "select authentication type",
      "placeHolder": "select authentication type",
      "style": "",
      "isDisabled": "",
      "list": [
        {
          "label": "AUTH_BASIC",
          "value": AUTH_BASIC
        },
        {
          "label": "AUTH_KERBEROS",
          "value": AUTH_KERBEROS
        },
        {
          "label": "AUTH_SSL",
          "value": AUTH_SSL
        },
         {
          "label": "AUTH_SASL",
          "value": AUTH_SASL
        }
      ],
      "labelVarCheckbox": "",
      "argIndex": 0,
      "validate": {
        "inputType": "text",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 0
      }
    },
     {
      "id": "$4",
      "type": "TextField",
      "label": "Username",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter Username",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "",
      "argIndex": 0,
      "validate": {
        "inputType": "Text",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 0
     }
   },
    {
      "id": "$5",
      "type": "TextField",
      "label": "Pasword",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter Password",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "",
      "argIndex": 0,
      "validate": {
        "inputType": "Text",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 0
     }
   },
    {
      "id": "$6",
      "type": "TextField",
      "label": "Database name",
      "value": "",
      "css": "p-grid p-align-center w-100-p",
      "title": "Enter dbname",
      "placeHolder": "",
      "style": "",
      "isDisabled": "",
      "labelVarCheckbox": "",
      "argIndex": 0,
      "validate": {
        "inputType": "Text",
        "disabled": false,
        "required": true,
        "min": 0,
        "max": 0
     }
   }
]
}
