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/2-start-app.mdx
+20-39Lines changed: 20 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,16 +41,11 @@ Let it run for a few minutes as it prepares your environment. It will clone the
41
41
Again, this might take a few minutes. It's a great time to grab a coffee. ☕️
42
42
:::
43
43
44
-
### Access the library website
45
-
46
-
Once the environment loads, you may see the following warning:
47
-
48
-
<Screenshoturl="https://github.com/mongodb-developer/library-management-system"src="img/screenshots/50-demo-app/2-start-app/7-visit-page.png"alt="A warning in the codespace saying 'You are about to access a development port served by someone's codespace'" />
49
-
50
-
You're seeing this warning because the development server is running on a publicly forwarded port, and GitHub shows a security notice anytime someone accesses a public port. Even in your own codespace, GitHub displays it just to confirm you intended to open that external-facing URL.
44
+
Once the command finishes, the application will be running on port 5400.
51
45
52
-
Click "Continue" to load the library application website. Once it loads, you're ready to move on to the next step.
46
+
In the *Terminal* tab at the bottom, look for the line `Server is running on port: 5400`. If it appears, the Node.js API for the library application is up and ready to serve requests.
Once the command finishes, the application will be up and running on port 5400.
73
68
74
-
:::warning
75
-
Right now, you should see an 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.
76
-
:::
77
-
78
-
### Set the MongoDB connection
79
-
To run the application in GitHub Codespaces, you now need to set the MongoDB connection string before starting the server.
80
-
In the terminal of your Codespace, run:
81
-
```
82
-
export MONGODB_URI="<YOUR_CONNECTION_STRING>"
83
-
```
84
-
After setting the environment variable, start the application again with:
85
-
```
86
-
mvn spring-boot:run
87
-
```
69
+
<Screenshoturl="https://github.com/mongodb-developer/library-management-system"src="img/screenshots/50-demo-app/2-start-app/6-app-started.png"alt="App is started on port 5000" />
Once the command finishes, the application will be up and running on port 5000.
71
+
</TabItem>
72
+
</Tabs>
91
73
92
-
<Screenshoturl="https://github.com/mongodb-developer/library-management-system"src="img/screenshots/50-demo-app/2-start-app/6-app-started.png"alt="App is started on port 5000" />
74
+
### Access the library website
93
75
94
-
### Expose the server port
76
+
Once the environment loads, you may see the following warning:
95
77
96
-
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.
78
+
<Screenshoturl="https://github.com/mongodb-developer/library-management-system"src="img/screenshots/50-demo-app/2-start-app/7-visit-page.png"alt="A warning in the codespace saying 'You are about to access a development port served by someone's codespace'" />
97
79
98
-
Look for the *Ports* tab at the bottom of the IDE.
80
+
You're seeing this warning because the development server is running on a publicly forwarded port, and GitHub shows a security notice anytime someone accesses a public port. Even in your own codespace, GitHub displays it just to confirm you intended to open that external-facing URL.
<Screenshoturl="https://github.com/mongodb-developer/library-management-system"src="img/screenshots/50-demo-app/2-start-app/4-port-visibility.png"alt="The Port Visibility menu" />
86
+
You should see the application with some books listed now.
105
87
106
-
You'll see the text in the *Visibility* column change to `Public`.
88
+
### Open the client in a new window
107
89
108
-
That's it! You're now ready to move to the next section.
90
+
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.
109
91
92
+
<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" />
110
93
111
-
</TabItem>
112
-
</Tabs>
113
94
114
95
## 🦸 Option 3: Run locally
115
96
@@ -163,10 +144,10 @@ npm start
163
144
<TabItemvalue="java"label="☕️ Java Spring Boot">
164
145
165
146
1. Before starting the backend, switch to the java-server project.
166
-
```
147
+
```
167
148
git checkout java-server
168
-
```
169
-
This command moves you into the correct project folder that contains the Java backend code.
149
+
```
150
+
This command moves you into the correct project folder that contains the Java backend code.
170
151
171
152
2. Set the MongoDB connection string as an environment variable:
Now that your environment is set up, you can explore it.
8
+
9
+
## Local MongoDB instance
10
+
11
+
The database you'll be using in this exercise is a local MongoDB Atlas deployment running inside the codespace's sandbox.
12
+
13
+
To explore the database and the imported dataset, click the leaf icon on the left sidebar to open the MongoDB extension. You’ll see a preset connection called **"Library DB"**. Expand it and browse the collections in the **library** database.
14
+
15
+
You can open the pre-loaded documents in the collections. For example, expand the `books` collection and open a document of your choice. This will open a JSON preview of the document in the editor. You can even edit the document in the editor - saving the file will update the document in the database.
Copy file name to clipboardExpand all lines: docs/60-schema-validation/2-validate-users.mdx
+1-15Lines changed: 1 addition & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,26 +6,12 @@ import TabItem from '@theme/TabItem';
6
6
7
7
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.
8
8
9
-
## Database user permissions
10
-
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:
12
-
13
-
1. Open the [Atlas UI](https://cloud.mongodb.com?utm_campaign=devrel&utm_source=workshop&utm_medium=cta&utm_content=developer.day&utm_term=project.phoenix).
14
-
2. In the left-hand menu, navigate to **Network Settings** and select "Database Access."
15
-
3. Locate your database user in the list. Check the **MongoDB Roles** column for the role of the user you are using for this workshop. If the role is not **atlasAdmin@admin**, you will need to update it.
16
-
4. If the role is not **atlasAdmin@admin**, click "Edit" button next to the user.
17
-
5. Scroll down to the **Database User Privileges** section and expand the **Built-in Role** dropdown.
18
-
6. Select "Atlas admin" from the dropdown menu.
19
-
7. Click "Update User" to save the changes.
20
-
21
-
Atlas will deploy the change in a few seconds.
22
-
23
9
## Explore the JSON schema
24
10
25
11
<TabsgroupId="server">
26
12
<TabItemvalue="node"label="🚀 NodeJS/Express">
27
13
28
-
The JSON schema for the `users` collection is stored in the `server/src/schema-validation/apply-schema.ts`[file](https://github.com/mongodb-developer/library-management-system/blob/main/server/src/schema-validation/apply-schema.ts). Open the file in your GitHub codespace and examine the schema.
14
+
The JSON schema for the `users` collection is stored in the `server/src/schema-validation/apply-schema.ts`[file](https://github.com/mongodb-developer/library-management-system/blob/main/server/src/schema-validation/apply-schema.ts). Open the file and examine the schema.
Copy file name to clipboardExpand all lines: docs/70-indexing/1-create-compound-index.mdx
+3-6Lines changed: 3 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -139,12 +139,9 @@ As soon as the application starts, you will see log entries showing the creation
139
139
140
140
## Verify that the index is created
141
141
142
-
1. Open the **VS Code extension** (leaf icon) from the sidebar on the left.
143
-
1. Click **Add Connection**.
144
-
1. In the welcome screen, click **Connect** under the **Connect with Connection String** section.
145
-
1. Enter the MongoDB connection string from your Atlas cluster, making sure to replace the **password placeholder**.
146
-
1. Press **Enter**.
147
-
1. In the sidebar, you should now see your database. Expand the **library** database, then the **issueDetails** collection, and finally select **Indexes**.
142
+
1. Open the **MongoDB extension** (leaf icon) from the sidebar on the left.
143
+
1. Click on **Library DB** to connect to the local MongoDB Atlas deployment.
144
+
1. Expand the **library** database, then the **issueDetails** collection, and finally select **Indexes**.
0 commit comments