Test the Connection

To test the connection, perform the following steps:

Note:
Python 3.10.11 should be present. You should also have the iAutomate installer package as it contains some resources to be used in subsequent steps.
  1. Download and extract the folder named, Resources.zip from Prerequisites path.
  2. Open the Command Prompt as Administrator mode, navigate to path inside the extracted folder “Resources > mongodb_prereqs > mongodb_batchfile_utils”, you can locate the file named mongodb_utils.bat which installs required libraries.
  3. Execute the bat file.
    Figure 1. Mongodb_Check_Connection_Utils
    A screenshot of a computer program Description automatically generated
  4. Open the Command Prompt as Administrator mode. Navigate to path inside the extracted folder “Resources > mongodb_prereqs > mongodb_check_connection_utils”, you can locate the file named mongo_connection_enterprise_Non-HA.py which is used to test the mongo connection
    cd <folder path>
  5. Execute the code by using the following command:
    python <file_name.py> <ip address>:<port> <user> <pwd> <path of PEMKeyFile > < path of CAFile >
    eg: python mongo_connection_enterprise_Non-HA.py 10.1.x.x:27017 <username> <password> "C:\Program Files\MongoDBMongoDB\Server\8.0\bin\server.pem" "C:\Program Files\MongoDB\Server\8.0\bin\ca.pem"
    <ip address> - IP address where mongo installation is done
    <port> - port mentioned in mongod.cfg under port section, usually defaults to port 27017
    <user> - username given in db.createUser method
    <pwd> - password given using db.createUser method
    < path of PEMKeyFile > - path of PEMKeyFile mentiond in mongod.cfg under ssl section
    < path of CAFile > - path of PEMKeyFile mentiond in mongod.cfg under ssl section
  6. If file executes without any error, then we will get a “Connection to Mongo Database successful" message.