[Java] TIL Java Spring Boot - Movie Review Site 001
Full Stack Development with Java Spring Boot, React, and MongoDB β Full Course
This is the course from freeCodeCamp to learn Java with react
You can find the video on YouTube here: https://youtu.be/5PdEmeopJVQ?si=uyg8MHc6LDpfd3kw
𧩠Problem
Environment setup
Since this is the first time using JDK, I will briefly review the environment setup. I wonβt go too deep about the core Java in this post.
JDK install
To install JDK, we need to go to the Oracle webpage or use the following command if you are a Mac user.
$ brew install openjdk@17
I used homebrew to install it to avoid any error related to the m1 chip.
After installing, run the following codes to check if JDK and JRE(Java Runtime Environment) are successfully installed on your local machine.
$ javac --version
$ java --version
IntelliJ IDEA
Next, we need a code editor or IDE for Java.
We choose IntelliJ IDEA in this course, so go to the website and choose the correct version. They had an open-source version, so I installed the open-source one.
π― Database Setup
MongoDB Setup
It is not a MongoDB course, so I skipped details about making a cluster, but if you follow the tutorial, it is pretty simple.
We will use this password to connect MongoDB with our Java backend, so leave a memo or copy this password for later.
IP address setup
In this course, the instructor uses 0.0.0.0/0
to access everywhere
for educational purposes.
But for security purposes, once the company or individual sets up the database, the database manager has to set it up with only allowed IP addresses. (e.g.) home(private), employees(company), etcβ¦)
MongoDB Compass setup
In this course, we are using MongoDB Compass to interact with GUI.
You must install the correct OS version if you have yet to install Compass.
The important thing is the second part. Copy the string from section two and paste it into the URI area.
Fix the <password>
part with your password that we copied previously.
The example is from the YouTube video, which already pasted passwords.
Creating Database
We donβt have to touch admin and local to create a new database. Click the plus button next to the database, and type the db name and collection name.
Since MongoDB is a non-relational database(NoSQL) and document-based database, we first have the database name and then the collection name to manage data. Collections are treated as tables in relational databases like MySQL or Oracle.
In this project, we will have the collection of movies, where we save different information about the movies.
Import JSON file to the collection
It is time to import the dataset from somewhere. In this course, we will use a prepared JSON file. If you download and import the JSON file on the Compass, the result will be the same as below.
π Takeaway
This series could be longer than expected due to the screenshots and the course content. I will reduce the content and screenshots because Iβm studying this, not teaching.
π» Solution
- None
π Review
-
In the real world, the database is not open to anybody. In MongoDB, setting up and allowing different IP addresses is used to solve this security problem.
-
MongoDB is NoSQL(stands for Not only SQL), known as a non-relational database. The most significant difference compared to relational databases such as Oracle or MySQL is that MongoDB does not have tables. Instead, they save the data in documents. Each document has a collection to manage the data. In this project, we have a
movie-api-db > movies
structure.
Comments