MongoDB Installation and Setup#
Last revised by S. Pattamudu-Manoharan on 2025 FEB 11
Introduction#
MongoDB is an optional installation that facilitates the use of the tool when working with a large amount of data.
Windows#
Download: Visit the MongoDB download page and download the MSI installer for Windows.
Install: Run the MSI file and follow the installation prompts. Choose “Complete” setup type and ensure “Install MongoDB as a Service” is checked.
Set Up Environment: Add MongoDB to the system PATH:
Go to Control Panel → System and Security → System → Advanced system settings → Environment Variables.
Select Path, click Edit, then New and add:
C:\Program Files\MongoDB\Server\<version>\bin
Start MongoDB:
Open Command Prompt.
Run:
mongod --version
Ensure MongoDB is installed properly.
macOS#
Prerequisites#
Homebrew requires the Xcode command-line tools from Apple’s Xcode.
Install Xcode Command-Line Tools#
Run:
xcode-select --install
Install Homebrew#
macOS does not include the Homebrew package manager by default.
Install Homebrew using the official documentation: Homebrew Documentation.
Install MongoDB: - Open Terminal. - Run:
brew tap mongodb/brew brew update brew install mongodb-community
Start MongoDB service:
brew services start mongodb/brew/mongodb-community
- (Optional) Install MongoDB Compass (Graphical Interface)
Visit the MongoDB Compass download page and download the DMG installer for macOS.
Run the DMG file and follow the installation prompts.
Setup LASP Credentials to Access MongoDB#
This step is required only for members of the SCB team working with the MongoDB database.
Windows#
Open the Start Menu and search for Environment Variables.
Select Edit the system environment variables.
In the System Properties dialog, click Environment Variables.
Under System variables or User variables, click New.
- Add the following details:
Variable name:
LASP_USER_NAME
Variable value:
<Your Value>
Variable name:
LASP_PASSWORD
If your LASP_PASSWORD contains any shell special characters (also called metacharacters), you must escape them using a backslash (
\
) so the shell interprets them as literal characters.Common shell special characters include:
$
,"
,'
,\
,!
,*
,&
,(
,)
,|
,;
,<
,>
,~
, and`
``.Examples:
If your password contains
$
, write it as\$
If it contains
!
, write it as\!
A backslash itself must be written as
\\
Variable value:
<Your Value>
Click OK to save changes.
Connect to the LASP VPN.
Make sure to add the
db_config.json
file to the config folder (It contains the DB Credentials - DB Name, HostName, URI, Port Number).
macOS/Linux#
Open a Terminal.
Edit your shell configuration file:
For bash, run:
sudo nano ~/.zshrc
Add the following lines at the end of the file:
export LASP_USER_NAME='YOUR_LASP_USER_NAME' export LASP_PASSWORD='YOUR_LASP_PASSWORD'
Save and exit: - Press CTRL + O, then Enter to save. - Press CTRL + X to exit.
Reload the profile to apply changes immediately:
source ~/.zshrc
Verify the variable is set (do not run while sharing screen):
echo $LASP_USER_NAME
Close this terminal and connect to the LASP VPN.
Make sure to add the
db_config.json
file to the config folder (It contains the DB Credentials - DB Name, HostName, URI, Port Number).