Skip to content

Commit 13e09f9

Browse files
authored
Merge pull request #3 from mongodb-developer/local_mongodb
Update lab docs to reflect local MongoDB changes
2 parents 3762a9b + 202f666 commit 13e09f9

File tree

65 files changed

+129
-295
lines changed

Some content is hidden

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

65 files changed

+129
-295
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,28 @@ Cells in a Jupyter notebook are a modular unit of code or text that you can exec
88
## Running a cell
99
To run a cell in a Jupyter notebook, hover over it and click the Run icon that appears against the cell.
1010

11-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-jupyter-notebooks/1-run-cell.png" alt="Run a cell" />
11+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-jupyter-notebooks/1-run-cell.png" alt="Run a cell" />
1212

1313
When a cell is running, you will see a loading spinner in the bottom left corner of the cell.
1414

15-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-jupyter-notebooks/2-running-cell.png" alt="A running cell" />
15+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-jupyter-notebooks/2-running-cell.png" alt="A running cell" />
1616

1717
## Successful cell runs
1818
When a cell is finished running successfully, you will see a green check mark appear in the bottom left corner of the cell.
1919

20-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-jupyter-notebooks/3-successful-cell.png" alt="Successful cell run" />
20+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-jupyter-notebooks/3-successful-cell.png" alt="Successful cell run" />
2121

2222
## Erroneous cell runs
2323
If an error occurred while running a cell, you will see a red cross appear in the bottom left corner of the cell, and also an error traceback after the cell.
2424

25-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-jupyter-notebooks/4-error-in-cell.png" alt="Erroneous cell run" />
25+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-jupyter-notebooks/4-error-in-cell.png" alt="Erroneous cell run" />
2626

2727
To fix errors, you may need to update previous cells. If you do, re-run all the cells following the one(s) you updated.
2828

2929
## Interrupting a cell
3030
To interrupt a running cell, click the Stop icon that you see against the cell while it is running.
3131

32-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-jupyter-notebooks/5-interrupt-cell.png" alt="Interrupt cell run" />
32+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-jupyter-notebooks/5-interrupt-cell.png" alt="Interrupt cell run" />
3333

3434
:::warning
3535
The UI might differ slightly if you are running Jupyter Notebooks in a different IDE. Refer to the appropriate documentation if running the notebook in a different environment.

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

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,56 @@ You will be working in a Jupyter Notebook in a GitHub Codespace throughout this
1212

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

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

17-
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.
17+
Let it run for a few seconds as it prepares a Docker container with all the required libraries and a MongoDB cluster.
18+
19+
Once the environment is built, you should see a VS Code IDE with a list of files under the Explorer tab.
1820

1921
In the left navigation bar of the IDE, click on the file named `vector-search-lab.ipynb` to open the Jupyter Notebook for this lab.
2022

21-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/2-dev-env-setup/2-nav-notebook.png" alt="Navigate to the notebook" />
23+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/2-nav-notebook.png" alt="Navigate to the notebook" />
2224

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

25-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/2-dev-env-setup/3-select-kernel.png" alt="Select kernel" />
27+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/3-select-kernel.png" alt="Select kernel" />
2628

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

29-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/2-dev-env-setup/4-python-env-modal.png" alt="Select Python Environments" />
31+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/4-python-env-modal.png" alt="Select Python Environments" />
3032

31-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/2-dev-env-setup/5-select-recommended.png" alt="Select recommended interpreter" />
33+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/5-select-recommended.png" alt="Select recommended interpreter" />
3234

3335
That's it! You're ready for the lab!
3436

37+
<details>
38+
<summary>🦹 Use the MongoDB for VS Code extension to interact with the local MongoDB cluster from the VSCode IDE </summary>
39+
40+
In the left navigation bar of the IDE, click on the leaf icon. Under Connections, click the **Add Connection** button.
41+
42+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/6-add-connection.png" alt="Add MongoDB connection" />
43+
44+
In the tab that appears, click the **Connect** button.
45+
46+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/7-click-connect.png" alt="Click Connect" />
47+
48+
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.
49+
50+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/8-enter-connection-string.png" alt="Enter connection string" />
51+
52+
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.
53+
54+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/9-connections.png" alt="View connections" />
55+
56+
</details>
57+
3558
## Option 2: Run locally
3659

3760
:::caution
3861
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.
3962
:::
4063

41-
If you want to run the notebook locally, follow the steps below:
64+
To run the lab locally, follow the steps below:
4265

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

@@ -74,4 +97,4 @@ jupyter notebook
7497

7598
* In the browser tab that pops up, open the file named `vector-search-lab.ipynb`.
7699

77-
<Screenshot url="localhost:8888/tree" src="img/screenshots/30-dev-env/2-dev-env-setup/6-jupyter-notebook.png" alt="Jupyter Notebook" />
100+
<Screenshot url="localhost:8888/tree" src="img/screenshots/20-dev-env/2-dev-env-setup/10-jupyter-notebook.png" alt="Jupyter Notebook" />

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# 👐 Setup prerequisites
2+
3+
Run the cells under the **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 obtain its connection string:
10+
11+
* Register for a [free MongoDB Atlas account](https://www.mongodb.com/cloud/atlas/register) if you don't already have one
12+
* [Create a new database cluster](https://www.mongodb.com/docs/guides/atlas/cluster)
13+
* [Obtain the connection string](https://www.mongodb.com/docs/guides/atlas/connection-string) for your database cluster
14+
15+
* Set the `MONGODB_URI` variable to the connection string for your cluster as follows:
16+
17+
```python
18+
MONGODB_URI = "<your_connection_string>"
19+
```
20+
:::

docs/30-dev-env/_category_.json renamed to docs/20-dev-env/_category_.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"label": "Dev Environment",
3-
"position": 30,
3+
"position": 20,
44
"link": {
55
"type": "generated-index",
66
"description": "Setup the dev environment and prerequisites"

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

Lines changed: 0 additions & 61 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/3-setup-pre-reqs.mdx

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

docs/30-import-data/1-import-data.mdx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# 👐 Import data into MongoDB
2+
3+
Let's first import a dataset to use for this lab. We will use a collection of books.
4+
5+
Run the cells under the **Step 2: Import data into MongoDB** section in the notebook to import the dataset for this lab into a MongoDB collection.
6+
7+
<details>
8+
<summary>🦹 Visually verify that the data has been imported into the local MongoDB cluster </summary>
9+
10+
Click the leaf icon in the left navigation bar of the IDE.
11+
12+
Ensure that you see a database called _mongodb_genai_devday_vs_, and a collection named _books_ under it.
13+
14+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-import-data/1-import-data/1-verify-collection.png" alt="Verify collection" />
15+
16+
Click the **>** arrow next to _books_ and note the number of documents.
17+
18+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-import-data/1-import-data/2-document-count.png" alt="Verify document count" />
19+
20+
To preview a document, click the **>** arrow next to _Documents_ and select a document from the list.
21+
22+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-import-data/1-import-data/3-preview-document.png" alt="Preview document" />
23+
</details>

0 commit comments

Comments
 (0)