Kony Fabric console User Guide: Integration > Configure the Integration Service > MongoDB Adapter

MongoDB Data Adapter

MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling.

With Kony Fabric MongoDB database adapter, you can connect to your own MongoDB database as an endpoint. For example, you can use MongoDB data adapter to implement a data store that provides high performance, high availability, and automatic scaling such as e-commerce product catalog, blogs and content management, and mobile and social networking sites.

After you configure the MongoDB document database adapter in Kony Fabric Console, you can create, read, update and delete (CRUD operations) on MongoDB collections and documents.

Perform the following steps to configure the MongoDB database adapter with Kony Fabric:

Configure MongoDB End-point Adapter

To configure the MongoDB Adapter in the Integration service definition tab, follow these steps:

  1. In the Name field, provide a unique name for your service.
  2. From the Service Type list, select MongoDB. The following sections are displayed:
    • Connection Parameters
    • Authentication
    • Advanced

  3. In Connection Parameters, you can either provide Connection URI or provide Connection Properties.
    • Connection URI: If you want to provide Connection URI, you must construct the URI and create a MongoDB client instance to connect to the database server.
      Connection URI format:

      mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]].


      The elements required to construct a Connection URI are as follows:
      ElementDescription
      mongodb://

      This is a mandatory prefix required to identify that this string is in standard connection format. Use a connection string prefix of mongodb+srv: rather than the standard mongodb: to leverage the DNS seedlist. The +srv is added as an indicator to the client that the hostname that follows it corresponds to a DNS SRV record. The driver or mongo shell will query the DNS for the record to determine the hosts that are running the MongoDB instances.

      username:password@ This field is optional. Use this to add authentication to access the MongoDB database.

      host[:port]

      Hostname, and port number. The port number is optional

      /database

      Name of the database. This is optional.

      ?<options>

      String that specifies the connection specific options as <name>=<value> pairs.
    • Connection Properties: If you want to provide Connection Properties, provide the following details:
      ParameterDescription
      Hostname

      Database connection URL.

      PortThe port number of the MongoDb server to which you want to connect.

      Database Name

      Name of the database name.

      User Name

      User ID for the connection URL

      Password

      User Password

      Connections per host

      Maximum number of connections allowed per host.

      Maximum Wait time

      Number in milliseconds that a thread may wait for a connection to become available.

      Connection Timeout

      Number of milliseconds the driver will wait before a new connection attempt is aborted.
      Socket TimeoutNumber of milliseconds a send or receive on a socket can take before timeout.
  4. To test the database connection, click Test Connection.

    If the entered details are correct, the system displays the message: Valid Database connection details.

    Important: If your database is configured with a proxy server, you must select an environment and then click Test Connection to test the database connectivity. The environment should be => V8.3.

    For example, you have the Kony Fabric Console installed on one machine, and the Runtime and Database servers installed on another machine. When you create an integration service of type MongoDB Database, the Console must be established with a VPN connection to the MongoDB Database server. So that, when you test the Database connection, the test case will be successful. You can do this by selecting the correct environment for your Runtime Server which will ensure a VPN connection between the Console and the Runtime Server and test the database. If the entered details are correct, the system displays the message: Valid Database connection details.

  5. In the Authentication section, you can select an identity provider from Use Existing Identity Provider. This drop-down lists the identity providers created for MongoDB data adapter in the Identity page. If you select any identity provider, you have to enter valid login credentials to access the database. Click Test Login and enter the credentials to verify the authentication service.
  6. Note: The Authentication section is optional.

  7. Note: The Advanced section is optional.

  8. Enter the Description for the service.
  9. Click SAVE or SAVE & ADD OPERATION to save your service definition.

Create and Configure Operations for MongoDB Adapter

The Operations List tab appears only after you save the service definition. Alternatively, you can also click Add > Add New Operation to create or configure operations.

Create

To create an operation, follow these steps:

  1. Select the check boxes for operations available for the MongoCollection and MongoDocument entities.
  2. Click Add Operation. The selected operation is added to the Configured Operations list. The default name format of a database operation is
    <MongoCollection/MongoDocument>_<operation_name> and these names are auto-generated.
    For example, MongoCollection_create  and  MongoDocument_create.

Configure

After you create operations, they are configured with request and response parameters by default.

The following table details pre-configured parameters for request and response operations :

MongoDB Operations Request Parameters Response Parameters
MongoCollection_Create
  • CollectionName
  • Collection name
MongoCollection_Read

NA

  • Collection names
MongoCollection_Delete

NA

NA
MongoDocument_Create
  • Record
  • CollectionName
  • MongoDocument
  • DocumentID
  • Record
  • Collection name
MongoDocument_Update
  • DocumentID
  • Record
  • Collection name
  • MongoDocument
  • DocumentID
  • Record
  • Collection name
MongoDocument_Get
  • OData Query
  • MongoDocument
  • DocumentID
  • Record
  • Collection name
MongoDocument_Delete
  • DocumentID
  • Collection name
NA

 

Key Terminology and Concepts of MongoDB

MongoDB stores BSON documents, for example, data records in collections; the collections in databases.

Refer the following table for key terminology.

Terminology Concept
Database In MongoDB, a database holds collections of documents.
Collection A collection is analogous to a table of an RDBMS. A collection may store any number of documents.
Document/Object

A document in MongoDB is analogous to a record in RDBMS and it is a data structure composed of field and value pairs have the following structure:

 {
   field1: value1,
   field2: value2,   
   ...
   fieldN: valueN
}

MongoDB documents are similar to JSON objects. The values of fields may include other documents, arrays, and arrays of documents.

Field A name-value pair in a document. A document has zero or more fields. Fields are analogous to columns in relational databases.

 

Advantages of MongoDB Data adapter

Following are the advantages of using MongoDB Adapter:

Limitations

Following are the limitations to use the Kony Fabric MongoDB Adapter:

Copyright © 2020 Kony, Inc. All rights reserved.