You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/50-demo-app/1-intro.mdx
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
1
# 📘 The Library Management System Application
2
2
3
-
Throughout this workshop, you will have the opportunity to interface with the data using the library management system application we've provided you. This application uses an Angular front end and a Node.js back end. The application is already built and deployed to a GitHub codespace, so you won't need to install anything in your local environment. You will be able to access the application from your browser.
3
+
Throughout this workshop, you will have the opportunity to interface with the data using the library management system application we've provided you. This application uses an Angular front end and a Node.js or Java Spring Boot back end. The application is already built and deployed to a GitHub codespace, so you won't need to install anything in your local environment. You will be able to access the application from your browser.
4
4
5
5
Our library management application leverages the data modeling patterns you'll explore throughout this workshop. As you navigate through the application, you'll witness how these patterns come to life, enhancing both the user experience and the efficiency of the system.
6
6
7
-
Our library application enables users to explore a rich catalog of books, search for specific titles, delve into book details, and even share their thoughts through comments. Users can also reserve books for future reading. Behind the scenes, MongoDB's data modeling patterns play a crucial role in ensuring the application's flexibility, scalability, and performance.
7
+
The application enables users to explore a rich catalog of books, search for specific titles, delve into book details, and even share their thoughts through comments. Users can also reserve books for future reading. Behind the scenes, MongoDB's data modeling patterns play a crucial role in ensuring the application's flexibility, scalability, and performance.
8
8
9
9
For library employees, an admin panel offers functionalities like managing book checkouts and returns. As we guide you through the application, you'll discover how the various design patterns we've discussed so far are seamlessly integrated to optimize data storage, retrieval, and overall system performance.
Go to the [GitHub repository](https://github.com/mongodb-developer/library-management-system) for the demo application. From there, you have two options to start the application.
7
+
You have two options to start the application.
6
8
7
9
## Option 1: Run in a codespace
8
10
9
-
:::info
10
-
11
-
🚀 __Express start: [Click here](https://github.com/codespaces/new/mongodb-developer/library-management-system?quickstart=1) to start a new codespace or resume your last one!__
12
-
13
-
:::
14
-
15
11
By far, the easiest way to start the application is to run it in a codespace. A codespace is a cloud-hosted, containerized development environment that you can connect to from Visual Studio Code. It comes pre-configured with all the tools you need to build and run the application.
16
12
17
13
In the case of this application, you can even use the online IDE to edit the code and see the changes reflected in the running application.
18
14
15
+
<TabsgroupId="server">
16
+
<TabItemvalue="node"label="🚀 NodeJS/Express">
17
+
18
+
Open the [repository on the `main` branch](https://github.com/mongodb-developer/library-management-system).
19
+
19
20
To start the application in a codespace, click "Code." Then, look for the *Codespaces* tab. Click "Create Codespace on main." This will create a new codespace for you and start the application.
Open the [repository on the `java-server` branch](https://github.com/mongodb-developer/library-management-system/tree/java-server).
29
+
30
+
To start the Java application in a codespace, check that you are in the `java-server` branch and then click "Code." Then, look for the *Codespaces* tab. Click "Create Codespace on java-server." This will create a new codespace for you and start the application.
Let it run for a few seconds as it prepares your environment. It will clone the repository, prepare the containers, and run the installation scripts. Once it's ready, you'll see an IDE, with a preview window that shows the running application.
24
40
25
41
:::note
@@ -28,6 +44,21 @@ Again, this might take a few minutes. It's a great time to grab a coffee. ☕️
Right now, you should see a big error message in the console, as we haven't configured the app yet. Don't worry, you'll get it up and running in a few minutes.
49
+
50
+
```
51
+
####### ###### ###### ####### ######
52
+
# # # # # # # # #
53
+
# # # # # # # # #
54
+
##### ###### ###### # # ######
55
+
# # # # # # # # #
56
+
# # # # # # # # #
57
+
####### # # # # ####### # #
58
+
```
59
+
:::
60
+
61
+
31
62
### Expose the server port
32
63
33
64
To get the application working in that environment, there is one small change you need to make to the codespace. You need to expose the port where the server is running.
@@ -66,6 +97,9 @@ Then, change to the `library-management-system` directory.
66
97
cd library-management-system
67
98
```
68
99
100
+
<TabsgroupId="server">
101
+
<TabItemvalue="node"label="🚀 NodeJS/Express">
102
+
69
103
Now, go to each of the `client` and `server` directories and install the dependencies.
70
104
71
105
```bash
@@ -88,4 +122,32 @@ cd client
88
122
npm start
89
123
```
90
124
125
+
</TabItem>
126
+
127
+
<TabItemvalue="java"label="☕️ Java Spring Boot">
128
+
129
+
You need to have a local JDK 17+ and Maven installed.
130
+
131
+
```bash
132
+
cd client
133
+
npm install
134
+
```
135
+
136
+
Start the server application.
137
+
138
+
```bash
139
+
cd java-server
140
+
mvn spring-boot:start
141
+
```
142
+
143
+
And, in another terminal window, start the client application.
144
+
145
+
```bash
146
+
cd client
147
+
npm start
148
+
```
149
+
150
+
</TabItem>
151
+
</Tabs>
152
+
91
153
You now have the client running on http://localhost:4200 and the server running on http://localhost:5000.
Now that your environment is set up, you can configure the application.
6
8
7
-
There should already be a file open in the IDE. If not, look in the file explorer on the left, and open the file `server/.env`. This file contains the configuration for the application.
9
+
There should already be a file open in the IDE. If not, look in the file explorer on the left, and open the file `.env`. This file contains the configuration for the application.
Clicking this will reload the client, which should now be connected to the database. You should see the application with some books listed now.
77
+
78
+
## Open the client in a new window
79
+
80
+
If you accidentally close the Client or want to open it in a separate tab/window go to the Ports tab, hover over Client and a world icon should appear. Click it and the client will open in a new tab.
81
+
82
+
<Screenshoturl="https://github.com/mongodb-developer/library-management-system"src="img/screenshots/50-demo-app/3-configure/open-client.png"alt="Click to open the client app" />
Copy file name to clipboardExpand all lines: docs/60-schema-validation/2-validate-users.mdx
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,10 @@
2
2
3
3
In this exercise, you will explore the pre-written JSON validation schema for the `users` collection, run a script to apply it to the collection, and test the schema validation by inserting a document that does not match the schema.
4
4
5
+
:::info
6
+
Note for Java users: schema validation rules are typically applied via a Javascript script! Although there's nothing stopping us to write this code in Java, this is usually a DB Admin task.
7
+
:::
8
+
5
9
## Database user permissions
6
10
7
11
To update the validator for any database collection, your database user must have admin privileges. Follow these steps to ensure your user has the correct permissions:
Copy file name to clipboardExpand all lines: docs/70-indexing/1-create-compound-index.mdx
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,9 @@
1
1
# 👐 Build a compound index following the ESR rule
2
2
3
+
:::info
4
+
Note for Java users: we will create indexes via a Javascript script! Although there's nothing stopping us to write this code in Java, this is usually a DB Admin task.
5
+
:::
6
+
3
7
In this exercise, you will build a compound index following the ESR rule, compare the query explain plans before and after creating the index, and analyze them.
0 commit comments