Fortinet Document Library

Version:


Table of Contents

1.0.0
Copy Link

About the connector

MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling. A record in MongoDB is a document, which is a data structure composed of field and value pairs. MongoDB documents are similar to JSON objects. The values of fields might include other documents, arrays, and arrays of documents.

This document provides information about the MongoDB connector, which facilitates automated interactions, with a MongoDB database using FortiSOAR™ playbooks. Add the MongoDB connector as a step in FortiSOAR™ playbooks and perform automated operations, such as inserting or updating documents, retrieving a list of all available collections from the MongoDB database, and querying the MongoDB database.

 

Version information

Connector Version: 1.0.0

Compatibility with FortiSOAR™ Versions: 4.10.3-161 and later

Compatibility with MongoDB Version: 3.6.5 and later

 

Installing the connector

For the procedure to install a connector, click here.

 

Prerequisites to configuring the connector

  • You must have the host details of the MongoDB server and the MongoDB database to which you will connect and perform the automated operations and the credentials to access that database.
  • To access the FortiSOAR™ UI, ensure that port 443 is open through the firewall for the FortiSOAR™ instance.

 

Configuring the connector

For the procedure to configure a connector, click here.

 

Configuration parameters

In FortiSOAR™, on the Connectors page, select the MongoDB connector and click Configure to configure the following parameters:

 

Parameter Description
Host MongoDB server host details. Host details can be the host address, the hostname or IP address, or the Unix domain socket path of a single MongoDB or multiple MongoDB instances to connect to which you will connect and perform the automated operations.
Database MongoDB database to which you will connect and perform the automated operations and for which you will provide authentication details
Username Username that is used to access the MongoDB database to which you will connect and perform the automated operations.
Password Password that is used to access the MongoDB database to which you will connect and perform the automated operations.
Port Port number used for connecting to the MongoDB database.
Auth Fields Other authentication fields, if required to connect to the MongoDB database.
For more details, see https://api.mongodb.com/python/current/examples/authentication.html.
Verify SSL Specifies whether the SSL certificate for the server is to be verified or not.
By default, this option is set as True.

 

Actions supported by the connector

The following automated operations can be included in playbooks and you can also use the annotations to access operations from FortiSOAR™ release 4.10.0 onwards:

 

Function Description Annotation and Category
Insert Documents Adds data to the MongoDB database in MongoDB collection you have specified. add_data
Investigation
Query Documents Queries a MongoDB collection and retrieves data from the MongoDB database, based on the filter you have specified. get_data
Investigation
Update Documents Updates documents in the MongoDB collection you have specified, based on the filter you have specified. update_data
Investigation
Delete Documents Deletes all documents in the MongoDB collection you have specified, based on the filter you have specified. delete_data
Remediation
Get Collections Retrieves a list of all available collections from the MongoDB database. list_tables
Investigation

 

operation: Insert Documents

Input parameters

 

Parameter Description
Collection Name Name of the collection in the MongoDB database in which you want to insert documents.
Data Data that you want to insert in the MongoDB database.

 

Output

The JSON output returns a Success message if the data is successfully inserted in the MongoDB database or an Error message containing the reason for failure.

Following image displays a sample output:

 

Sample output of the Insert Documents operation

 

operation: Query Documents

Input parameters

 

Parameter Description
Collection Name Name of the collection in the MongoDB database in which you want to query for documents.
Filter Filter criteria based on which you want to retrieve documents from the MongoDB database.

 

Output

The JSON output contains data retrieved from the MongoDB database based on the filter criteria you have specified.

Following image displays a sample output:

 

Sample output of the Query Documents operation

 

operation: Update Documents

Input parameters

 

Parameter Description
Collection Name Name of the collection in the MongoDB database in which you want to update documents.
Filter Filter criteria to be applied to documents that you want to update in the MongoDB database. All documents that match the filter criteria that you have specified will be updated.
Data to Update Data that you want to update in the filtered documents.

 

Output

The JSON output returns a Success message if the document(s) are successfully updated in the MongoDB database, based on the filter criteria you have specified, or an Error message containing the reason for failure.

Following image displays a sample output:

 

Sample output of the Update Documents operation

 

operation: Delete Documents

Input parameters

 

Parameter Description
Collection Name Name of the collection in the MongoDB database from which you want to delete documents.
Filter Filter criteria to be applied to documents that you want to delete in the MongoDB database. All documents that match the filter criteria that you have specified will be deleted.

 

Output

The JSON output returns a Success message if the document(s) are successfully deleted in the MongoDB database, based on the filter criteria you have specified, or an Error message containing the reason for failure.

Following image displays a sample output:

 

Sample output of the Delete Documents operation

 

operation: Get Collections

Input parameters

None.

Output

The JSON output contains a list of all available collections retrieved from the MongoDB database.

Following image displays a sample output:

 

Sample output of the Get Collections operation

 

Included playbooks

The Sample - MongoDB - 1.0.0 playbook collection comes bundled with the MongoDB connector. This playbook contains steps using which you can perform all supported actions. You can see the bundled playbooks in the Automation > Playbooks section in FortiSOAR™ after importing the MongoDB connector.

  • Delete Documents
  • Get Collections
  • Insert Documents
  • Query Documents
  • Update Documents

Note: If you are planning to use any of the sample playbooks in your environment, ensure that you clone those playbooks and move them to a different collection since the sample playbook collection gets deleted during connector upgrade and delete.

 

About the connector

MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling. A record in MongoDB is a document, which is a data structure composed of field and value pairs. MongoDB documents are similar to JSON objects. The values of fields might include other documents, arrays, and arrays of documents.

This document provides information about the MongoDB connector, which facilitates automated interactions, with a MongoDB database using FortiSOAR™ playbooks. Add the MongoDB connector as a step in FortiSOAR™ playbooks and perform automated operations, such as inserting or updating documents, retrieving a list of all available collections from the MongoDB database, and querying the MongoDB database.

 

Version information

Connector Version: 1.0.0

Compatibility with FortiSOAR™ Versions: 4.10.3-161 and later

Compatibility with MongoDB Version: 3.6.5 and later

 

Installing the connector

For the procedure to install a connector, click here.

 

Prerequisites to configuring the connector

 

Configuring the connector

For the procedure to configure a connector, click here.

 

Configuration parameters

In FortiSOAR™, on the Connectors page, select the MongoDB connector and click Configure to configure the following parameters:

 

Parameter Description
Host MongoDB server host details. Host details can be the host address, the hostname or IP address, or the Unix domain socket path of a single MongoDB or multiple MongoDB instances to connect to which you will connect and perform the automated operations.
Database MongoDB database to which you will connect and perform the automated operations and for which you will provide authentication details
Username Username that is used to access the MongoDB database to which you will connect and perform the automated operations.
Password Password that is used to access the MongoDB database to which you will connect and perform the automated operations.
Port Port number used for connecting to the MongoDB database.
Auth Fields Other authentication fields, if required to connect to the MongoDB database.
For more details, see https://api.mongodb.com/python/current/examples/authentication.html.
Verify SSL Specifies whether the SSL certificate for the server is to be verified or not.
By default, this option is set as True.

 

Actions supported by the connector

The following automated operations can be included in playbooks and you can also use the annotations to access operations from FortiSOAR™ release 4.10.0 onwards:

 

Function Description Annotation and Category
Insert Documents Adds data to the MongoDB database in MongoDB collection you have specified. add_data
Investigation
Query Documents Queries a MongoDB collection and retrieves data from the MongoDB database, based on the filter you have specified. get_data
Investigation
Update Documents Updates documents in the MongoDB collection you have specified, based on the filter you have specified. update_data
Investigation
Delete Documents Deletes all documents in the MongoDB collection you have specified, based on the filter you have specified. delete_data
Remediation
Get Collections Retrieves a list of all available collections from the MongoDB database. list_tables
Investigation

 

operation: Insert Documents

Input parameters

 

Parameter Description
Collection Name Name of the collection in the MongoDB database in which you want to insert documents.
Data Data that you want to insert in the MongoDB database.

 

Output

The JSON output returns a Success message if the data is successfully inserted in the MongoDB database or an Error message containing the reason for failure.

Following image displays a sample output:

 

Sample output of the Insert Documents operation

 

operation: Query Documents

Input parameters

 

Parameter Description
Collection Name Name of the collection in the MongoDB database in which you want to query for documents.
Filter Filter criteria based on which you want to retrieve documents from the MongoDB database.

 

Output

The JSON output contains data retrieved from the MongoDB database based on the filter criteria you have specified.

Following image displays a sample output:

 

Sample output of the Query Documents operation

 

operation: Update Documents

Input parameters

 

Parameter Description
Collection Name Name of the collection in the MongoDB database in which you want to update documents.
Filter Filter criteria to be applied to documents that you want to update in the MongoDB database. All documents that match the filter criteria that you have specified will be updated.
Data to Update Data that you want to update in the filtered documents.

 

Output

The JSON output returns a Success message if the document(s) are successfully updated in the MongoDB database, based on the filter criteria you have specified, or an Error message containing the reason for failure.

Following image displays a sample output:

 

Sample output of the Update Documents operation

 

operation: Delete Documents

Input parameters

 

Parameter Description
Collection Name Name of the collection in the MongoDB database from which you want to delete documents.
Filter Filter criteria to be applied to documents that you want to delete in the MongoDB database. All documents that match the filter criteria that you have specified will be deleted.

 

Output

The JSON output returns a Success message if the document(s) are successfully deleted in the MongoDB database, based on the filter criteria you have specified, or an Error message containing the reason for failure.

Following image displays a sample output:

 

Sample output of the Delete Documents operation

 

operation: Get Collections

Input parameters

None.

Output

The JSON output contains a list of all available collections retrieved from the MongoDB database.

Following image displays a sample output:

 

Sample output of the Get Collections operation

 

Included playbooks

The Sample - MongoDB - 1.0.0 playbook collection comes bundled with the MongoDB connector. This playbook contains steps using which you can perform all supported actions. You can see the bundled playbooks in the Automation > Playbooks section in FortiSOAR™ after importing the MongoDB connector.

Note: If you are planning to use any of the sample playbooks in your environment, ensure that you clone those playbooks and move them to a different collection since the sample playbook collection gets deleted during connector upgrade and delete.