## Run MongoDB Enterprise 

The MongoDB instance stores its data files in /var/lib/mongodb and its log files in /var/log/mongodb by default, and runs using the mongodb user account. You can specify alternate log and data file directories in /etc/mongod.conf . See systemLog.path and storage.dbPath for additional information. 

If you change the user that runs the MongoDB process, you must modify the access control rights to the /var/lib/mongodb and /var/log/mongodb directories to give this user access to these directories. 

Step 1: Start MongoDB. Issue the following command to start mongod : 

sudo service mongod start 

Step 2: Verify that MongoDB has started successfully Verify that the mongod process has started successfully by checking the contents of the log file at /var/log/mongodb/mongod.log for a line reading 

[initandlisten] waiting for connections on port <port> 

where <port> is the port configured in /etc/mongod.conf , 27017 by default. 

Step 3: Stop MongoDB. As needed, you can stop the mongod process by issuing the following command: 

sudo service mongod stop 

Step 4: Restart MongoDB. Issue the following command to restart mongod : 

sudo service mongod restart 

Step 5: Begin using MongoDB. To help you start using MongoDB, MongoDB provides Getting Started Guides in various driver editions. See getting-started for the available editions. 

Before deploying MongoDB in a production environment, consider the Production Notes (page 197) document. 

Later, to stop MongoDB, press Control+C in the terminal where the mongod instance is running. 

## Uninstall MongoDB 

To completely remove MongoDB from a system, you must remove the MongoDB applications themselves, the con- figuration files, and any directories containing data and logs. The following section guides you through the necessary steps. 

Warning: This process will completely remove MongoDB, its configuration, and all databases. This process is not reversible, so ensure that all of your configuration and data is backed up before proceeding. 

Step 1: Stop MongoDB. Stop the mongod process by issuing the following command: 

sudo service mongod stop 

