Installing a MongoDB Service

Learn how to install a MongoDB database.

Direct Approach

The most straightforward approach is to go directly to MongoDB’s official website, and, depending on your OS, you can download and install the MongoDB service to be run locally. MongoDB offers two versions: one is free and under the community license, the other is the enterprise version.

Using Docker

This approach uses the official MongoDB image to start the service, similar to the approach with Postgres. To do so, run this Docker command:

docker run --name deno-mongo -d mongo

This command will start your MongoDB service via Docker. Don’t forget to check that the service is running with docker ps. If everything is working as expected, you can skip to the last sectionto learn how to connect to the database.

Using MongoDB Atlas

For this section, you’ll use a cloud service called MongoDB Atlas (previously known as Mlab), which will allow you to host a MongoDB database in the cloud. This service is part of the MongoDB company. You’ll need to create an account and log in to their website. Once you’ve done that, you should land on this home page:

Get hands-on with 1200+ tech skills courses.