Skip to content

Commit 670d31e

Browse files
author
ajosh0504
committed
Changes for local MongoDB
1 parent 5175eab commit 670d31e

File tree

56 files changed

+133
-288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+133
-288
lines changed

docs/30-dev-env/1-dev-env-setup.mdx renamed to docs/20-dev-env/1-dev-env-setup.mdx

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import Screenshot from "@site/src/components/Screenshot";
77

88
Navigate to [this](https://github.com/codespaces/new/mongodb-developer/genai-devday-notebooks?quickstart=1) link. Click the **Resume this codespace** button to resume the code space you created previously.
99

10-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-dev-env-setup/1-resume-codespace.png" alt="Resume codespace" />
10+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/1-resume-codespace.png" alt="Resume codespace" />
1111

1212
Give the codespace a few seconds to restart. When files appear under the Explorer, click the file named `ai-rag-lab.ipynb`. This is the Jupyter Notebook you will be using throughout this lab.
1313

14-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-dev-env-setup/3-nav-notebook.png" alt="Navigate to the notebook" />
14+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/2-nav-notebook.png" alt="Navigate to the notebook" />
1515
</details>
1616

1717
:::tip
@@ -24,33 +24,56 @@ You will be working in a Jupyter Notebook in a GitHub Codespace throughout this
2424

2525
Navigate to [this](https://github.com/codespaces/new/mongodb-developer/genai-devday-notebooks?quickstart=1) link. You will be prompted to sign into GitHub if you haven't already. Once signed in, click the **Create new codespace** button to create a new codespace.
2626

27-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-dev-env-setup/2-create-codespace.png" alt="Start a codespace" />
27+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/3-create-codespace.png" alt="Start a codespace" />
2828

29-
Let it run for a few seconds as it prepares your environment. It will clone the repository, prepare the container, and run the installation scripts. Once the environment is built, you should see a list of files appear under the Explorer.
29+
Let it run for a few seconds as it prepares a Docker container with all the required libraries and a MongoDB cluster.
30+
31+
Once the environment is built, you should see a VS Code IDE with a list of files under the Explorer tab.
3032

3133
In the left navigation bar of the IDE, click on the file named `ai-rag-lab.ipynb` to open the Jupyter Notebook for this lab.
3234

33-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-dev-env-setup/3-nav-notebook.png" alt="Navigate to the notebook" />
35+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/2-nav-notebook.png" alt="Navigate to the notebook" />
3436

3537
Next, select the Python interpreter by clicking **Select Kernel** at the top right of the IDE.
3638

37-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-dev-env-setup/4-select-kernel.png" alt="Select kernel" />
39+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/4-select-kernel.png" alt="Select kernel" />
3840

3941
In the modal that appears, click **Python environments...** and select the interpreter that is marked as **Recommended** or **Global Env**.
4042

41-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-dev-env-setup/5-python-env-modal.png" alt="Select Python Environments" />
43+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/5-python-env-modal.png" alt="Select Python Environments" />
4244

43-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-dev-env-setup/6-select-recommended.png" alt="Select recommended interpreter" />
45+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/6-select-recommended.png" alt="Select recommended interpreter" />
4446

4547
That's it! You're ready for the lab!
4648

49+
<details>
50+
<summary>🦹 Use the MongoDB for VS Code extension to interact with the local MongoDB cluster from the VSCode IDE </summary>
51+
52+
In the left navigation bar of the IDE, click on the leaf icon. Under Connections, click the **Add Connection** button.
53+
54+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/7-add-connection.png" alt="Add MongoDB connection" />
55+
56+
In the tab that appears, click the **Connect** button.
57+
58+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/8-click-connect.png" alt="Click Connect" />
59+
60+
In the modal that appears at the top of the screen, enter the string `mongodb://admin:mongodb@mongodb:27017/` and hit `Enter` on your keyboard.
61+
62+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/9-enter-connection-string.png" alt="Enter connection string" />
63+
64+
If the connection was successful, you should see the cluster and its default databases under Connections. Any additional databases and collections created during the lab will appear here as well.
65+
66+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/10-connections.png" alt="View connections" />
67+
68+
</details>
69+
4770
## Option 2: Run locally
4871

4972
:::caution
5073
During the lab, we will use GitHub Codespaces. These instructions are here just in case you can't use Codespaces or if you really, really, really want a local installation.
5174
:::
5275

53-
If you want to run the notebook locally, follow the steps below:
76+
To run the lab locally, follow the steps below:
5477

5578
* Clone the [GitHub repo](https://github.com/mongodb-developer/genai-devday-notebooks.git) for this lab by executing the following command from the terminal:
5679

@@ -86,4 +109,4 @@ jupyter notebook
86109

87110
* In the browser tab that pops up, open the file named `ai-rag-lab.ipynb`.
88111

89-
<Screenshot url="localhost:8888/tree" src="img/screenshots/30-dev-env/1-dev-env-setup/7-jupyter-notebook.png" alt="Jupyter Notebook" />
112+
<Screenshot url="localhost:8888/tree" src="img/screenshots/20-dev-env/1-dev-env-setup/11-jupyter-notebook.png" alt="Jupyter Notebook" />

docs/20-dev-env/2-setup-pre-reqs.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# 👐 Setup prerequisites
2+
3+
Replace any placeholders and run the cells under **Step 1: Setup prerequisites** section in the notebook.
4+
5+
:::info
6+
7+
Additional steps **if you are running the lab locally**:
8+
9+
* Spin up a MongoDB Atlas cluster and set the `MONGODB_URI` variable in this step to the connection string for your cluster as follows:
10+
11+
```python
12+
MONGODB_URI = "<your_connection_string>"
13+
```
14+
15+
Follow these steps to get set up with a MongoDB Atlas cluster:
16+
17+
* Register for a [free MongoDB Atlas account](https://www.mongodb.com/cloud/atlas/register)
18+
* [Create a new database cluster](https://www.mongodb.com/docs/guides/atlas/cluster/?utm_campaign=devrel&utm_source=third-party-content&utm_medium=cta&utm_content=multimodal_rag_tutorial&utm_term=apoorva.joshi)
19+
* [Obtain the connection string](https://www.mongodb.com/docs/guides/atlas/connection-string/?utm_campaign=devrel&utm_source=third-party-content&utm_medium=cta&utm_content=multimodal_rag_tutorial&utm_term=apoorva.joshi) for your database cluster
20+
21+
* Manually set the value of the `SERVERLESS_URL` variable as follows:
22+
23+
```python
24+
SERVERLESS_URL = "https://vtqjvgchmwcjwsrela2oyhlegu0hwqnw.lambda-url.us-west-2.on.aws/"
25+
```
26+
:::
File renamed without changes.

docs/20-mongodb-atlas/1-create-account.mdx

Lines changed: 0 additions & 67 deletions
This file was deleted.

docs/20-mongodb-atlas/2-create-cluster.mdx

Lines changed: 0 additions & 67 deletions
This file was deleted.

docs/20-mongodb-atlas/3-connection-string.mdx

Lines changed: 0 additions & 27 deletions
This file was deleted.

docs/20-mongodb-atlas/_category_.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/30-dev-env/2-setup-pre-reqs.mdx

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)