Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/50-demo-app/1-intro.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# 📘 The Library Management System Application

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.
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.

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.

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.
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.

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.

Expand Down
76 changes: 69 additions & 7 deletions docs/50-demo-app/2-start-app.mdx
Original file line number Diff line number Diff line change
@@ -1,25 +1,41 @@
import Screenshot from '@site/src/components/Screenshot';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# 👐 Start the Application

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.
You have two options to start the application.

## Option 1: Run in a codespace

:::info

🚀 __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!__

:::

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.

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.

<Tabs groupId="server">
<TabItem value="node" label="🚀 NodeJS/Express">

Open the [repository on the `main` branch](https://github.com/mongodb-developer/library-management-system).

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.

<Screenshot url="https://github.com/mongodb-developer/library-management-system" src="img/screenshots/50-demo-app/2-start-app/1-codespace.png" alt="Create codespace button" />

</TabItem>

<TabItem value="java" label="☕️ Java Spring Boot">

Open the [repository on the `java-server` branch](https://github.com/mongodb-developer/library-management-system/tree/java-server).

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.

<Screenshot url="https://github.com/mongodb-developer/library-management-system/tree/java-server" src="img/screenshots/50-demo-app/2-start-app/1-codespace-java.png" alt="Create codespace button" />

</TabItem>
</Tabs>



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.

:::note
Expand All @@ -28,6 +44,21 @@ Again, this might take a few minutes. It's a great time to grab a coffee. ☕️

<Screenshot url="https://github.com/mongodb-developer/library-management-system" src="img/screenshots/50-demo-app/2-start-app/2-codespace.png" alt="The codespace" />

:::warning
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.

```
####### ###### ###### ####### ######
# # # # # # # # #
# # # # # # # # #
##### ###### ###### # # ######
# # # # # # # # #
# # # # # # # # #
####### # # # # ####### # #
```
:::


### Expose the server port

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.
Expand Down Expand Up @@ -66,6 +97,9 @@ Then, change to the `library-management-system` directory.
cd library-management-system
```

<Tabs groupId="server">
<TabItem value="node" label="🚀 NodeJS/Express">

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

```bash
Expand All @@ -88,4 +122,32 @@ cd client
npm start
```

</TabItem>

<TabItem value="java" label="☕️ Java Spring Boot">

You need to have a local JDK 17+ and Maven installed.

```bash
cd client
npm install
```

Start the server application.

```bash
cd java-server
mvn spring-boot:start
```

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

```bash
cd client
npm start
```

</TabItem>
</Tabs>

You now have the client running on http://localhost:4200 and the server running on http://localhost:5000.
52 changes: 48 additions & 4 deletions docs/50-demo-app/3-configure.mdx
Original file line number Diff line number Diff line change
@@ -1,27 +1,65 @@
import Screenshot from "@site/src/components/Screenshot";
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# 👐 Configure the Application

Now that your environment is set up, you can configure the application.

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.
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.

The file should look like this:
<Tabs groupId="server">
<TabItem value="node" label="🚀 NodeJS/Express">

```bash
File: `server/.env`


```
PORT=5000
DATABASE_URI="mongodb+srv://user:password@serverurl"
DATABASE_NAME="library"
SECRET="secret"
```
</TabItem>

<TabItem value="java" label="☕️ Java Spring Boot">

File: `/java-server/src/main/resources/.env`

```
DATABASE_NAME=library
# Add here the MongoDB URI of your database cluster
DATABASE_URI=
```
</TabItem>
</Tabs>




You'll need to change the `DATABASE_URI` parameter to match your connection string. That's the same one you used to import the data.

:::tip
Don't remember how to get your connection string? Check out the [Import Data](/docs/importing-data/import-data) section.
:::

Copy and paste your connection string into the `DATABASE_URI` parameter. The file will automatically save, and the server will restart.
Copy and paste your connection string into the `DATABASE_URI` parameter.

<Tabs groupId="server">
<TabItem value="node" label="🚀 NodeJS/Express">
The file will automatically save, and the server will restart.
</TabItem>

<TabItem value="java" label="☕️ Java Spring Boot">
You need to start the server. Click on the terminal window and type:

```shell
$ mvn spring-boot:run
```

</TabItem>
</Tabs>


In the *Terminal* tab at the bottom, look for the `Server is running on port: 5000` line. If you see it, you're good to go!

Expand All @@ -36,3 +74,9 @@ In the upper right panel, click the refresh icon to reload the client.
<Screenshot url="https://github.com/mongodb-developer/library-management-system" src="img/screenshots/50-demo-app/3-configure/2-reload.png" alt="The refresh icon" />

Clicking this will reload the client, which should now be connected to the database. You should see the application with some books listed now.

## Open the client in a new window

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.

<Screenshot url="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" />
4 changes: 4 additions & 0 deletions docs/60-schema-validation/2-validate-users.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

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.

:::info
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.
:::

## Database user permissions

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:
Expand Down
4 changes: 4 additions & 0 deletions docs/70-indexing/1-create-compound-index.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 👐 Build a compound index following the ESR rule

:::info
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.
:::

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.

## Explore the code
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.