A practical guide to MongoDB and How to Install It on Catalina OS
We all know how fun and efficient it can be to work on an Apple computer where you can prototype graphical interfaces, do data analysis, develop web applications, and even run database servers with your own equipment.
However, Apple can often surprise us with their OS updates that make programming a bit more challenging, such as the recent arrival of Catalina macOS. This update has changed how we work, since we can no longer write commands into our terminal that directly affect the root directory (/). That's why in this post we will teach you how to install MongoDB on Catalina macOS so that you can continue working efficiently with your Apple.
Databases are the cornerstone of all technology platforms. Relational databases (SQL) are the ones we have always known and non-relational databases (NoSQL) are a relatively new development that took the world of technology by surprise and are here to stay. Some of the advantages of non-relational databases over relational ones are:
Bases de datos
MongoDB is a database that belongs to a group of NoSQL, or non-relational, databases. In MongoDB, each record is stored in a JSON document which is composed of fields that are grouped in collections.
MongoDB can be used for any application or platform that needs to store semi-structured data. MongoDB is very useful when we are looking for scalability in our projects as it allows us to grow horizontally without problems.
Here are a couple of reasons why you should be using MongoDB in your projects.
If you expect your project to continuously evolve, MongoDB is the perfect database for you, as it will allow you to grow vertically as well as horizontally.
MongoDB allows us to create powerful queries with less code, saving a lot of time and making us more efficient when analyzing the metrics of our projects.
This is probably the biggest advantage of MongoDB, since you don't have to pay for licenses to use it within your project.
MongoDB recommends that we use the more complete version of MongoDB Server, so we recommend downloading the MongoDB Enterprise version for macOS in TGZ format.
$tar -xvzf [name-of-the-file.tgz]
$ cd [name-of-the-folder]/bin
$ sudo bash
$ cp * /usr/local/bin
$ sudo bash
$ mkdir -p ~/data/db
$ chmod 777 ~/data
$ chmod 777 ~/data/db
$ touch /usr/local/etc/mongod.conf
Write the following into the file you just created:
storage: dbPath: /Users/[youruser]/data/db
You will have to modify your .zshrc file by adding the following:
alias mongod='mongod -f /usr/local/etc/mongod.conf'
Done! Now you can run the mongod command on our terminal and use MongoDB normally.
Databases are a small but incredibly important part of the programming world. If you already know how to program or are just learning and want to take your skills to the next level, then you should look into our Web Development Bootcamp, where we will teach you how to use non-relational databases and many other tools that will make you into a full stack developer.
Happy Coding! ❤️
Follow the steps of more than a thousand career changers and entrepreneurs that launched their careers in the tech industry with Ironhack's bootcamps.