Skip to content

Commit 4373c6a

Browse files
committed
Fix markup for Java
1 parent 59e7099 commit 4373c6a

File tree

10 files changed

+37
-38
lines changed

10 files changed

+37
-38
lines changed

docs/50-demo-app/2-start-app.mdx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ Right now, you should see an error message in the console, as we haven't configu
8686
### Set the MongoDB connection
8787
To run the application in GitHub Codespaces, you now need to set the MongoDB connection string before starting the server.
8888
In the terminal of your Codespace, run:
89-
```Java
89+
```
9090
export MONGODB_URI="<YOUR_CONNECTION_STRING>"
9191
```
9292
After setting the environment variable, start the application again with:
93-
```Java
93+
```
9494
mvn spring-boot:run
9595
```
9696

@@ -131,13 +131,13 @@ During the lab, we will use GitHub Codespaces. These instructions are here just
131131

132132
First, clone the repository to your local machine.
133133

134-
```bash
134+
```
135135
git clone git@github.com:mongodb-developer/library-management-system.git
136136
```
137137

138138
Then, change to the `library-management-system` directory.
139139

140-
```bash
140+
```
141141
cd library-management-system
142142
```
143143

@@ -146,7 +146,7 @@ cd library-management-system
146146

147147
Now, go to each of the `client` and `server` directories and install the dependencies.
148148

149-
```bash
149+
```
150150
cd client
151151
npm install
152152
cd ../server
@@ -155,13 +155,13 @@ npm install
155155

156156
Start the server application.
157157

158-
```bash
158+
```
159159
npm start
160160
```
161161

162162
And, in another terminal window, start the client application.
163163

164-
```bash
164+
```
165165
cd client
166166
npm start
167167
```
@@ -178,7 +178,7 @@ This command moves you into the correct project folder that contains the Java ba
178178

179179
2. Set the MongoDB connection string as an environment variable:
180180
- On Linux / macOS:
181-
```bash
181+
```
182182
export MONGODB_URI="<YOUR_CONNECTION_STRING>"
183183
````
184184
@@ -194,7 +194,7 @@ This command moves you into the correct project folder that contains the Java ba
194194
```
195195
196196
4. Run the client:
197-
```bash
197+
```
198198
(cd ../client && npm install && npm start)
199199
```
200200

docs/60-schema-validation/2-validate-users.mdx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ The function uses the `db.command()` method to apply the schema to the `users` c
9393
<TabItem value="java" label="☕️ Java Spring Boot">
9494
In this step, we’ll review the code that applies schema validation to the users collection.
9595
It’s already implemented in `SchemaValidationConfig.java` no changes needed. We’ll look at two methods:
96-
```java title='src/main/java/com/mongodb/devrel/library/infrastructure/config/SchemaValidationConfig.java'
96+
```kotlin title='src/main/java/com/mongodb/devrel/library/infrastructure/config/SchemaValidationConfig.java'
9797
@Configuration
9898
public class SchemaValidationConfig {
9999

@@ -139,17 +139,16 @@ You need to run the script to apply the schema to the `users` collection.
139139

140140
1. Run the following command to apply the schema to the `users` collection:
141141

142-
```sh
142+
```
143143
cd server
144144
npx tsx src/schema-validation/apply-schema.ts
145-
146145
```
147146

148147
You might be prompted to allow pasting into the terminal. Click "Allow" to paste the command.
149148

150149
Click "Enter" to run the command. After a few seconds, you should see the following output:
151150

152-
```sh
151+
```
153152
Connecting to MongoDB Atlas...
154153
Connected!
155154
@@ -166,7 +165,7 @@ To apply the schema, you must set this property to **apply**.
166165

167166
Stop the application if it’s running and restart it with:
168167

169-
```java
168+
```kotlin
170169
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dlab.schema-mode=apply"
171170
```
172171

@@ -193,7 +192,7 @@ Now that the schema validation is enabled for the `users` collection, you can te
193192
2. Explore the call to the `insertOne()` function around line 12 that will try to insert a new user and the error handling code around line 18.
194193
3. Execute the script by running the following command.
195194

196-
```sh
195+
```
197196
npx tsx src/schema-validation/test-validation.ts
198197
```
199198

@@ -210,7 +209,7 @@ The [validateUserSchema](https://github.com/mongodb-developer/library-management
210209

211210
To trigger it, stop the application if it’s running and start it again with the property set to **test**:
212211

213-
```java
212+
```kotlin
214213
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dlab.schema-mode=test"
215214
```
216215

docs/60-schema-validation/3-validate-authors.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This is an advanced exercise that requires you to write code. If you get stuck a
1313
1. Start by opening the `server/src/schema-validation/apply-schema.ts` file in your GitHub codespace and uncomment lines 41-61.
1414
1. Complete the tasks marked with `// TODO` comments.
1515
1. Execute the script again to apply the schema to the `authors` collection.
16-
```bash
16+
```
1717
cd server
1818
npx tsx src/schema-validation/apply-schema.ts
1919
@@ -24,7 +24,7 @@ This is an advanced exercise that requires you to write code. If you get stuck a
2424
<TabItem value="java" label="☕️ Java Spring Boot">
2525
In this advanced exercise, you will extend the [SchemaValidationConfig](https://github.com/mongodb-developer/library-management-system/blob/java-server/java-server/src/main/java/com/mongodb/devrel/library/infrastructure/config/SchemaValidationConfig.java) class to support the authors collection.
2626
Two methods are already defined in the class, but both are left with `// TODO` markers for you to implement:
27-
```java title='src/main/java/com/mongodb/devrel/library/infrastructure/config/SchemaValidationConfig.java'
27+
```kotlin title='src/main/java/com/mongodb/devrel/library/infrastructure/config/SchemaValidationConfig.java'
2828
private void applyAuthorSchema(MongoDatabase db) {
2929
// TODO: Implement the schema for authors ($jsonSchema with required 'name', 'bio', etc.)
3030
}
@@ -37,11 +37,11 @@ private void validateAuthorsSchema(MongoDatabase db) {
3737
Once implemented, you can run the application with the right target and mode:
3838

3939
- Apply the schema to authors
40-
```java
40+
```kotlin
4141
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dlab.schema-mode=apply -Dlab.schema-target=authors"
4242
```
4343
- Test the schema validation for authors
44-
```java
44+
```kotlin
4545
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dlab.schema-mode=test -Dlab.schema-target=authors"
4646
```
4747

docs/70-indexing/1-create-compound-index.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ In this exercise, you will build a compound index following the ESR rule, compar
4343
4444
3. Execute the script to create the compound index.
4545
46-
```bash
46+
```
4747
npx tsx src/indexing/borrowed-books-index.ts
4848
```
4949
5050
After a few seconds, you should see the following output:
5151
52-
```bash
52+
```
5353
Connecting to MongoDB Atlas...
5454
Connected!
5555

@@ -82,7 +82,7 @@ In this exercise, you will build a compound index following the ESR rule, compar
8282
<TabItem value="java" label="☕️ Java Spring Boot">
8383

8484
1. Let’s start with our `IssueDetail` record. Right now, it looks like this:
85-
```java title='src/main/java/com/mongodb/devrel/library/domain/model/IssueDetail.java'
85+
```kotlin title='src/main/java/com/mongodb/devrel/library/domain/model/IssueDetail.java'
8686
@Document(collection = "issueDetails")
8787
public record IssueDetail(
8888
// fields ..
@@ -92,7 +92,7 @@ In this exercise, you will build a compound index following the ESR rule, compar
9292
2. Now let’s optimize queries that need to filter or sort by multiple fields.
9393
For example, we often query by `user._id`, `returnedDate`, and `borrowDate` together.
9494
To speed this up, we can add a compound index using the **@CompoundIndex** annotation.
95-
```java title='src/main/java/com/mongodb/devrel/library/domain/model/IssueDetail.java'
95+
```kotlin title='src/main/java/com/mongodb/devrel/library/domain/model/IssueDetail.java'
9696
@Document(collection = "issueDetails")
9797
@CompoundIndex(
9898
name = "user_returned_borrow_idx",
@@ -127,7 +127,7 @@ This ensures that any indexes defined in your domain models (for example, with `
127127

128128
1. Restart the app typing in the Terminal:
129129

130-
```bash
130+
```
131131
mvn spring-boot:run
132132
```
133133
As soon as the application starts, you will see log entries showing the creation of indexes, similar to the image below.

docs/75-optimize/2-patterns.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ At this point, we also have to do additional queries to display the first five r
7777
Let's look at the current code that is used to retrieve a single book.
7878
Open the [`BookService`](https://github.com/mongodb-developer/library-management-system/blob/java-server/java-server/src/main/java/com/mongodb/devrel/library/domain/service/BookService.java) class and check the `getBook` method:
7979

80-
```java title='src/main/java/com/mongodb/devrel/library/domain/service/BookService.java'
80+
```kotlin title='src/main/java/com/mongodb/devrel/library/domain/service/BookService.java'
8181
public Optional<Book> getBook(String id) {
8282
Aggregation aggregation = Aggregation.newAggregation(
8383
Aggregation.match(Criteria.where("_id").is(id)),

docs/75-optimize/3-optimize.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ How could you simplify this code to make it blazing fast, using the patterns we
4444
<summary>Click here to see the answer</summary>
4545

4646
<div>
47-
```java title='src/main/java/com/mongodb/devrel/library/domain/service/BookService.java'
47+
```kotlin title='src/main/java/com/mongodb/devrel/library/domain/service/BookService.java'
4848
public Optional<Book> getBook(String id) {
4949
return bookRepository.findById(id);
5050
}

i18n/zh/docusaurus-plugin-content-docs/current/50-demo-app/2-start-app.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,19 @@ import Screenshot from '@site/src/components/Screenshot';
5656

5757
首先,将仓库克隆到你的本地机器。
5858

59-
```bash
59+
```
6060
git clone git@github.com:mongodb-developer/library-management-system.git
6161
```
6262

6363
然后,切换到 library-management-system 目录。
6464

65-
```bash
65+
```
6666
cd library-management-system
6767
```
6868

6969
现在进入 client 和 server 目录并安装依赖项。
7070

71-
```bash
71+
```
7272
cd client
7373
npm install
7474
cd ../server
@@ -77,13 +77,13 @@ npm install
7777

7878
启动服务器应用程序。
7979

80-
```bash
80+
```
8181
npm start
8282
```
8383

8484
然后,在另一个终端窗口,启动客户端应用程序。
8585

86-
```bash
86+
```
8787
cd client
8888
npm start
8989
```

i18n/zh/docusaurus-plugin-content-docs/current/60-schema-validation/2-validate-users.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const resultUsers = await db.command({
8080

8181
1. 运行以下命令将模式应用于 `users` 集合:
8282

83-
```sh
83+
```
8484
cd server
8585
node dist/schema-validation/apply-schema.js
8686
```
@@ -89,7 +89,7 @@ const resultUsers = await db.command({
8989

9090
按回车键运行命令。几秒钟后,您应该会看到以下输出:
9191

92-
```sh
92+
```
9393
Connecting to MongoDB Atlas...
9494
Connected!
9595
@@ -112,7 +112,7 @@ const resultUsers = await db.command({
112112

113113
您应该会看到一条错误消息。在错误消息的最底部,您应该会看到以下内容:
114114

115-
```sh
115+
```
116116
"schemaRulesNotSatisfied": [{
117117
"operatorName": "required",
118118
"specifiedAs": {"required": ["name","isAdmin"]},

i18n/zh/docusaurus-plugin-content-docs/current/60-schema-validation/3-validate-authors.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
1. 首先打开 GitHub Codespace 中的 `server/src/schema-validation/apply-schema.ts` 文件,并取消注释第 41-61 行。
88
1. 完成标有 `// TODO` 注释的任务。
99
1. 再次执行脚本以将模型应用于 `authors` 集合。
10-
```bash
10+
```
1111
cd server
1212
node dist/schema-validation/apply-schema.js
1313
```

i18n/zh/docusaurus-plugin-content-docs/current/70-indexing/1-create-compound-index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ In this exercise, you will build a compound index following the ESR rule, compar
3636
3737
3. Execute the script to create the compound index.
3838
39-
```bash
39+
```
4040
npx tsx src/indexing/borrowed-books-index.ts
4141
```
4242
4343
After a few seconds, you should see the following output:
4444
45-
```bash
45+
```
4646
Connecting to MongoDB Atlas...
4747
Connected!
4848

0 commit comments

Comments
 (0)