wsl install mongodb code example

Example: wsl install mongodb

Install MongoDB
To install MongoDB on WSL (Ubuntu 18.04):

Open your WSL terminal (ie. Ubuntu 18.04).
Update your Ubuntu packages: sudo apt update
Once the packages have updated, install MongoDB with: sudo apt-get install mongodb
Confirm installation and get the version number: mongod --version
There are 3 commands you need to know once MongoDB is installed:

sudo service mongodb status for checking the status of your database.
sudo service mongodb start to start running your database.
sudo service mongodb stop to stop running your database.
 Note