Installing MongoDB

You can install MongoDB as described in this topic.

Before you begin

Following are the supported versions.
Software Version
MongoDB Community Edition
Fix Pack 11
MongoDB 7.0.2
Fix Pack 10
MongoDB 7.0*
Fix Pack 7
MongoDB 4.0.25
Fix Pack 6
MongoDB 4.0.23**
Fix Pack 3
MongoDB 4.0.22
Fix Pack 1
MongoDB 3.4
Note:
  • * Supported by only Red Hat® Enterprise Linux® (RHEL) Server 9.2 and 8.8.
  • ** Red Hat Enterprise Linux (RHEL) Server 8.4 does not support MongoDB 4.0.23.
Note: For Red Hat Enterprise Linux (RHEL) Server 7.9 and CentOS 7, you cannot update Python and MongoDB versions as they are not Operating system-compatible.

Procedure

  1. Install MongoDB by using either of the following links:
  2. Optional: To upgrade, use the following links. You need to upgrade MongoDB 3.4 > MongoDB 3.6 > MongoDB 4.0.
  3. Open MongoDB configuration file by using the following command:
    vi /etc/mongod.conf
  4. In the mongod.conf file, add the following lines:
    # Where and how to store data. storage:
    dbPath: /var/lib/mongo journal:
    enabled: true # engine:
    # mmapv1:
    # wiredTiger:
    # how the process runs processManagement:
    fork: true # fork and run in background
    pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
    # network interfaces net:
    port: 27017
    bindIp: 127.0.0.1 # Listen to local interface only, comment to listen on all interfaces.
    #security: #operationProfiling: #replication: #sharding:
    ## Enterprise-Only Options #auditLog:
    #snmp:
    Note: If MongoDB is installed on the same physical server as the IBM® Product Master the value of bindIp should be set to 127.0.0.1. If the server is different, set the value of bindIp to 0.0.0.0.
  5. Open MongoDB Shell by using the following command:
    MongoDB 7.0
    mongosh
    MongoDB 4.0.25 and earlier
    mongo
  6. Quit the MongoDB shell by pressing, Ctrl + C, and then restart the MongoDB.
  7. Verify that the MongoDB has started successfully. You can verify that the mongod process has started successfully by either of the following.
    • Checking the contents of the log file at /var/log/mongodb/mongod.log for the following line:
      [initandlisten] waiting for connections on port <port> 
      Where,
      <port> - Port that is configured in the /etc/mongod.conf file. The default value is 27017.
    • Use the following command.
      chkconfig mongod on 
  8.  Machine learning  To create database and user in MongoDB, run the following commands in the MongoDB console:
    MongoDB 7.0
    >mongosh
    
    	>use <database_name>
    
    	>db.createCollection('<test_collection_name>')
    
    	>show databases
    MongoDB 4.0.25 and earlier
    >mongo
    
    	>use <database_name>
    
    	>db.createCollection('<test_collection_name>')
    
    	>show databases
    To create user for the database, see step 1 in the Enabling authentication.
    Note: The database for DAM is created per company when you add the DAM settings in the Settings page > Application settings page of the Persona-based UI. For more information, see Customizing the features.