---
# System prepended metadata

title: Mongo is a database

---

- Mongo is a database
- A database is usually connected to via  a url becuase it is being provisioned as a server

To connect to a server, you need an address which is usually a URL (Universal Resource Locator).

If this url is on the same OS you are connecting from , you can use this address format `http://localhost:port`, e.g http://localhost:27017. 27017 is the default port for mongodb just like how most servers will always have a default port... 

A default port is the port a server runs with when a specific port is not specified. This means you can decide to setup a special port for your database when running it locally...

All this I have written specifically relates to any kind of server that runs locally. It could be a database server, an FTP server (server for serving files), a normal http server (e.g. express)....


So this brings us to the conclusion that a Mongo database is also a server. 

There is something I didn't mention in regards to the address format. I will cover it here now


A Quite comprehensive format for an address format should look like this::: 
            
             <protocol>://<host><port>
             
- `<protocol>` refers to the allowed protocol for connecting to a server e.g, http, https, ftp, mongo, wss, ws
- `<host>` refers to the computer you are connected to, every computer connected to the internet has  host address i.e. the remote host address while your local computer has a host address too... Host addresses can either be a number or set alphanumeric character (this can include symbols too). An example of a remote address is `facebook.com`, `192.168.0.1`, `what-the-hell.com` and examples of local address is `localhost`, `127.0.0.1`, `0.0.0.0`. Bear it in mind that you can manipulate your local address to look a remote address if you know where to go and if your local computer is connected to a wifi network or LAN as the case maybe, you could also have it bear other of address names. Got it? 
- `<port>`: This refers to the port the server you are trying to access is running. Bear it mind that all servers , as far as I know has to run on a port. Whenever a port is not specified is , bear it mind that the computer assumes you are trying to call port 80. That is why all websites online run on port 80 becuase they don't want you to start specifying the port when reaching them , imagine writing `https://facebook.com:80`, so instead you just say `https://facebook.com`, that way the browser knows you are referring to port 80.

For Mongodb, you can run it locally on your PC or host it online and access it from there. Bear in mind, that is the same for any of kind of server except in uncommon situations.

To run Mongodb locally, you have to download it and start it . the instructions to download and start it is on their website. Bear in mind that you will need to use this same format ( `<protocol>://<host><port>`) to access it after installing it just like any other server. An example of a mongo url is: `mongodb://localhost:27017/` where `mongodb` is the protocol, `localhost` is the host and `27017` is the port.

You must heard of Atlas, Mongodb Atlas simply allows you to run a mongodb server on the internet by saving you the stress of hosting your own , although that could also be because the mongodb license does not give full rights to host it by your access.

When you set up a mongodb server on Atlas, they give you certain configuration to adjust a lot of things via a form. This is nice for beginners because that would have been done on the terminal instead which could have been a more difficult experience.

Also, you are going to be given a mongodb url for your Atlas Mongodb Url which will look like this:

```
mongodb+srv://glory:DeeEZ_spOM_H@core.6tjwdt1.mongodb.net/nobox?retryWrites=true&w=majority
```

Where 
- `mongodb+srv` is the protocol
- `glory` is the username
- `DeeEZ_spOM_H` is the password
- `core.6tjwdt1.mongodb.net` is the host
- `nobox?retryWrites=true&w=majority` are just extra parameters

The reason why we have a new protocol is because as expected, a server can be accessed via different kinds of protocol.

The reason why we also have username and a password is because the mongodb server is password protected , if not , it will simply look like this `mongodb+srv://core.6tjwdt1.mongodb.net/nobox?retryWrites=true&w=majority`

