In last article I have described how to install 64-bit Rapberry Pi operation system, Docker and Docker compose. Now it is time to install Mongo DB database that can be installed only on 64-bit system. I will use official Mongo DB Docker image from Docker hub for ARM 64 architecture.

Mongo DB

MongoDB is a cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with optional schemas. MongoDB is developed by MongoDB Inc. and licensed under the Server Side Public License (SSPL).

This is definition from Wiki. Database can be used for multiple purposes for creating applications using wide variety of programming languages, including: C, C# and .NET, C++, Erlang, Haskell, Java, JavaScript, Perl, PHP, Python, Ruby, and Scala. I think every programmer is familiar with JSON notations, so it will be easy to start working with this database and create queries.

Install Robo 3T - Mongo DB client

First of all need to install client for Mongo DB that will connect to database. I recommend to use Robo 3T. It has versions for Windows, Mac and Linux operating systems and is freeware. If you have Windows this should not be a problem to download exe file and install program. For Linux it can be little more complicated.

For Linux first of all download file robo3t-1.4.1-linux-x86_64-122dbd9.tar.gz from Robo 3T download page. File name can be different in case new version is released. Then switch to directory where this file is saved

1. Enter following commands

tar -xvzf robo3t-1.4.1-linux-x86_64-122dbd9.tar.gz
sudo mkdir /usr/local/bin/robo3t
sudo mv robo3t-1.4.1-linux-x86_64-122dbd9/* /usr/local/bin/robo3t
cd /usr/local/bin/robo3t/bin
sudo chmod +x robo3t 
sudo nano ~/.bashrc

2. Add the following line to the end of .bashrc file

alias robo3t='/usr/local/bin/robo3t/bin/robo3t'

3. Save and close file, reload using this command

source ~/.bashrc

4. Now can start Robo 3T using terminal


If it is working, then installation is complete. Next step is to install Mongo DB server.

Install Mongo DB server

As we use Docker and Docker compose for Mongo DB server, create new yml file

nano docker-compose.yml

Base configuration required to run container is

version: '3.7'
    container_name: mongodb
    image: mongo:latest
    restart: unless-stopped
      MONGO_INITDB_ROOT_PASSWORD: rootpassword
      - 27017:27017
      - /home/pi/docker-volumes/mongodb:/data/db
  • MONGO_INITDB_ROOT_USERNAME - parameter to specify root user name
  • MONGO_INITDB_ROOT_PASSWORD - parameter to specify root user password
  • volumes - file path where Mongo DB data files will be stored

All other settings can leave as they are in this example.

Now can run container

docker-compose up -d

Now can try to connect to database using Robo 3T application.

  1. Start Robo 3T
  2. Add new connection to database as showed on screenshots

On first tab specify any name for connection and IP address of Raspberry Pi with Mongo DB. On second tab specify user name and password. Then save connection.

That's all. Connect to Mongo DB and then can create new database, collections, indexes, etc.


This is one more way how to use Raspberry Pi computer. Hosting database for small project on Raspberry Pi has many advantages: you have not to pay for hosting, fully control database and simply this is cool that serious software can be run on such small hardware! Of  course on high load database will require more powerful hardware, but for education, experiments, small projects or just for fun it is good enough.