VOGO Voice – Knowledge Base

MongoDB

Estimated reading time: 3 min

Database Type:  NoSQL Database

Support: Read, Insert, Update

Introduction

MongoDB is an open-source document database. This document-oriented cross-platform database has its functioning based on the concept of document and collection. In simpler terms, the database in MongoDB acts as a repository for collections and data. 

Being a leading NoSQL database, it is used by numerous industries across the world for storing data in a key-value pair. This performance-oriented, cross-platform database supports dynamic queries by means of the document-oriented language it employs. It seamlessly supports the sharing of data, provides quicker access to data and is easily scalable as any other relational database.

The VOGO Voice MongoDB connector provides easy access to execute the READ, INSERT, and UPDATE functions.

Prerequisites

  • MongoDB database with access to connection credentials
  • Ability to whitelist IP address if the server is behind Firewall
  • Knowledge in writing document-oriented/object-oriented queries

Anatomy of Settings

Defining Settings values for AddMongoDB Connection

Name: It refers to the name assigned to the instance of the connector created.

Host: Provide the host address of the Mongo server to which connection is intended. This refers to the client’s host address used to authenticate the connection. 

Port: Connection with the client and database server happens through a regular TCP/IP connection. MongoDB uses TCP as its transport layer protocol. The predefined default port for connection is 27017.

Username: Provide the specific username of the MongoDB database to which you want to connect. Within the database environment the username determines access privileges to database objects and also the same is user-specific as it is essential to restrict to which database the users can connect.

Password: To access remote data, authenticating to the external data source is required. To serve this purpose provide the password to connect. 

Disclaimer: The password/private information is encrypted when saved within the VOGO Voice platform for your security.

Connector Usage

Now that a connector is established it can now be used within any interaction flow. Each usage of the connector will allow different configurations to retrieve different results. Those settings can be either static or dynamic based on the needs.

Anatomy of Configuration

Defining Configuration Values for MongoDB Connector

Name: The name assigned to identify the connector and the results data. The assigned name is used every time the connector is called to action through the components in the interaction builder platform. 

Database: It is the physical repository for collections and is equivalent to a relational database table. Typically, a single MongoDB server has multiple databases and each database gets its own set of files on the file system. The drop-down list will automatically be populated with the databases hosted by the server. Select the required database to which connection is intended. 

Collection: A collection which is the equivalent of an RDBMS table (Relational  Database Management System) is a grouping of MongoDB documents that exist within the selected database. Also, these documents within a collection can have different fields. The drop-down list will automatically be populated based on the chosen database that has been pulled in. Select the desired collection based on the results to be returned. 

Method: The drop-down list against this field provides the list of methods from which the required method to execute the query can be selected. 

  • find – MongoDB find() method executes a query and fetches the document in a collection and returns the first batch of results and cursor id for the documents from which the client can construct a cursor. Hence, when the find () function is used to search for documents in the collection, the result returns a pointer to the collection of documents returned matching the criteria requested by the user. The cursor is the pointer to the result set of a query and is used to extract all the results of a query from the database. To learn more, visit https://docs.mongodb.com/manual/reference/command/find/index.html
  • findOne – findOne() method is used to return a single document that satisfies the specified query criteria. Let’s say If multiple documents satisfy the query, then this method when put to use will return only the first matching document in its natural order from the specified collection. MongoDB findOne() always includes the _id field even if not specified explicitly in the projection parameter unless it is excluded, and also it is to be noted that the findOne() returns only a document and not a cursor. To learn more, visit
    https://docs.mongodb.com/manual/reference/method/db.collection.findOne/index.html

Filter – The query predicate which defines the logical condition is applied in order to return results matching the criteria requested by the user. 

Options: (This optional section is provided to specify the fields to return results using projection operators as mentioned below)
Project fields – Specifies the list of fields to be displayed in the returned document.
Sort – Represents the sort specification for the ordering of the results.
     Max Time (ms) – The cumulative time limit in milliseconds for processing operations on the cursor.
     Skip – Number of documents to skip. Defaults to 0.
     Limit – The maximum number of documents to return. If unspecified, then defaults to no
limit. A limit of 0 is equivalent to setting no limit.

           To learn more about the fields, the methods employed and its related syntax, visit 
https://docs.mongodb.com/

Caching: To know about caching, click here.

Tags:
Was this article helpful?
Dislike 0
Previous: CARTO