-
-
Notifications
You must be signed in to change notification settings - Fork 8
MongoDB Installation
Follow these steps in order to install MongoDB in the exact same configuration as the test bench for the oauth
development branch.
Note: This is the instructions for Windows x64, with the DB server being run on command rather than being available as a background service. This is because such a configuration is better suited for localhost test benches where the servers won't up up for long durations, and are only needed during testing.
Note2: MongoDB does not work with WSL
Note3: MongoDB binds to localhost by default. Remote access requires explicit configuration of bindIp
or setting the --bind_ip
flag
-
Download the
.msi
installer - Run the downloaded installer
- Choose the
Complete
setup (unless you don't have enough free space) - Uncheck
Install MongoD as a Service
- Install MongoDB Compass (default behaviour; optional)
- This is so that we can interact with the DB through a GUI interface
- If you prefer a purely CLI approach, you may skip this and just install MongoDB Shell later
- Add
C:\Program Files\MongoDB
to PATH- This is where the server and DB tools reside
- Open up your PowerShell profile
- e.g.
code $PROFILE
command
- e.g.
- Add the following to the end of the file:
$mongoDirectory = "C:\Program Files\MongoDB\Server\6.0\bin" Set-Alias mongod "$mongoDirectory\mongod.exe"
- Save the file, close and reopen an Administrative PowerShell
- Create a folder for the contents of your databases
- Default data location for the DB is at
C:\data\db
, so just create this folder if you don't have any preferences
- Default data location for the DB is at
- Use the command
mongod -h
, and you should see a help text in PowerShell- You may now start the DB by doing
mongod
in PowerShell - Default data location for the DB is at
C:\data\db
- You may change this behaviour by creating a folder for where you'd like the data to be, then add the followibng flag to
mongod
for the first run:--dbpath="<FULL/PATH/TO/FOLDER>"
- You may now start the DB by doing
Note: you may need to install this if you chose not to install MongoDB Compass
-
Download the
.msi
installer - Run the downloaded installer
- Note: The
.msi
installer adds the shell to PATH - If you choose the
.zip
installer instead, you have to manually add the shell to PATH
- Note: The
- When MongoDB is running, you may now use
mongosh
to connect to the DB in command line- Just like how we use the command
mysql
to connect to the DB from the command line
- Just like how we use the command
Note: This is what we'll be using to flash the sample DB structure for test benches
-
Download the
.msi
installer - Run the downloaded installer
- Add DB Tools to PATH
- If you did not change the default install location, you can ignore this step