How to Search Mongo Databases

This article describes how to craft a Mongo database connection string. This is required to add a Mongo database as a searchable Target in Spirion Sensitive Data Platform.

Overview

To search a MongoDB database in Spirion Sensitive Data Platform requires a connection string. The connection string is used when configuring your MongoDB Target.

Troubleshooting a connection to the Mongo Database is also described in this document.

Before You Start

  • Mongo Database connection strings can vary widely.
  • Consult your DBA when generating a connection string.
  • If you are using a self-signed certificate, you must use a different connection string. Example below.
    • Example of a working connection string requiring SSL and using self-signed certificates:
    mongodb://<username>:<password>@<hostname>:<port>/?ssl=true&sslAllowInvalidCertificates=true

How to Create a Mongo Database Connection String

Creating a Mongo Database connection string is a manual process.

A typical connection string resembles the following code block:

<DatabaseItems Connection="mongodb://user:password@host_ip:host_port" Type="MongoDb" />

  • <user> is the username portion of the credentials
  • <password> is the password portion of the credentials
  • <host_ip> is the host name or IP address of the host server
  • <host_port> is the host port to connect through
    • Default Port: 27017 for MongoDB, if not specified
    • If <host_port> is not provided, the colon character ':' must be omitted as well. 
    • Following the above example, "mongodb://<user>:<pswd>@<hostip>" would be used to connect to port 27017 on the provided host IP address

How to Add a Mongo Database as a Target in Spirion Sensitive Data Platform

Procedure:

  1. From the left side navigation menu select Data Asset Inventory > Data Assets and Targets.
  2. The "Data Assets and Targets" page opens.
  3. Select the TARGETS tab at the top of the page.

  4. Select the blue Actions button in the top right corner of the page.
  5. Select "Add Target" from the drop-down menu.
  6. Enter a descriptive name for the new database Target.
  7. Select the "Database" tile.
  8. The "Select a Database to Configure" pop-up window opens.
  9. Select the mongoDB tile under "Select a Database to Configure" from the bottom part of the pop-up window.
  10. The "Add New MongoDB Database Target" pop-up window opens.
  11. Enter the connection string for the desired Mongo database that you wish to scan.
  12. Click the Save button.

  13. Continue setting up your scan. For more information on setting up a scan, see this article.

How to Troubleshoot a Mongo Database Connection

Several tools exist that can help troubleshoot a MongoDB connection.

MongoDB Compass

MongoDB Compass helps users explore their data and test connection strings.

Mongo Shell

Mongo Shell is a command-line tool that will help diagnose connection issues.


Was this article helpful?