Skip to content

Commit 8263513

Browse files
author
ajosh0504
committed
Making MongoDB viz elements non-optional
1 parent dd2c4b0 commit 8263513

23 files changed

+47
-67
lines changed

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

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,50 +8,53 @@ In this lab, we will be using Jupyter Notebooks, which is an interactive Python
88

99
## Option 1: GitHub Codespaces
1010

11-
You will be working in a Jupyter Notebook in a GitHub Codespace throughout this lab. A codespace is a cloud-hosted, containerized development environment that comes pre-configured with all the tools you need to run this lab.
11+
You will be working in GitHub Codespaces throughout this lab. A codespace is a cloud-hosted, containerized development environment that comes pre-configured with all the tools you need to run this lab.
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

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

19-
In the Explorer menu, under `notebooks`, click on the file named `vector-search-lab.ipynb` to open the Jupyter Notebook for this lab.
19+
### Connect to the MongoDB cluster
2020

21-
<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" />
21+
Once the environment is built, you will be prompted to connect to the MongoDB cluster via MongoDB's VSCode extension. This will allow you to visualize the data that we will import into the cluster later in the lab, directly from the VSCode IDE.
2222

23-
Next, select the Python interpreter by clicking **Select Kernel** at the top right of the IDE.
23+
To connect to the cluster, click the **Connect** button.
2424

25-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/3-select-kernel.png" alt="Select kernel" />
25+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/2-click-connect.png" alt="Click Connect" />
2626

27-
In the modal that appears, click **Python environments...** and select the interpreter that is marked as **Recommended** or **Global Env**.
27+
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.
2828

29-
<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" />
29+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/3-enter-connection-string.png" alt="Enter connection string" />
3030

31-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/5-select-recommended.png" alt="Select recommended interpreter" />
31+
If the connection was successful, you should see **Connected to: mongodb:27017** with a green indicator.
3232

33-
That's it! You're ready for the lab!
33+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/4-connection-successful.png" alt="Connection successful" />
34+
35+
You can view the default and any additional collections we create on the cluster during the lab by clicking the leaf icon in the left navigation bar of the IDE.
3436

35-
<details>
36-
<summary>🦹 Use the MongoDB for VS Code extension to interact with the local MongoDB cluster from the VSCode IDE. </summary>
37+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/5-view-collections.png" alt="View collections" />
3738

38-
In the left navigation bar of the IDE, click on the leaf icon. Under Connections, click the **Add Connection** button.
39+
### Jupyter Notebook setup
3940

40-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/6-add-connection.png" alt="Add MongoDB connection" />
41+
You will be filling code in a Jupyter Notebook during this lab, so let's get set up with that next!
4142

42-
In the tab that appears, click the **Connect** button.
43+
Click on the files icon in the left navigation bar. In the Explorer menu, under `notebooks`, click on the file named `vector-search-lab.ipynb` to open the Jupyter Notebook for this lab.
4344

44-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/7-click-connect.png" alt="Click Connect" />
45+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/6-nav-notebook.png" alt="Navigate to the notebook" />
4546

46-
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.
47+
Next, select the Python interpreter by clicking **Select Kernel** at the top right of the IDE.
48+
49+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/7-select-kernel.png" alt="Select kernel" />
4750

48-
<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+
In the modal that appears, click **Python environments...** and select the interpreter that is marked as **Recommended** or **Global Env**.
4952

50-
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+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/8-python-env-modal.png" alt="Select Python Environments" />
5154

52-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/9-connections.png" alt="View connections" />
55+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/9-select-recommended.png" alt="Select recommended interpreter" />
5356

54-
</details>
57+
That's it! You're ready for the lab!
5558

5659
## Option 2: Run locally
5760

@@ -67,10 +70,10 @@ To run the lab locally, follow the steps below:
6770
git clone https://github.com/mongodb-developer/genai-devday-notebooks.git
6871
```
6972

70-
* `cd` into the cloned directory:
73+
* `cd` into the `notebooks` directory of the cloned repository:
7174

7275
```
73-
cd genai-devday-notebooks
76+
cd genai-devday-notebooks/notebooks
7477
```
7578

7679
* Create and activate a Python virtual environment:

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

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,16 @@ Let's first import a dataset to use for this lab. We will use a collection of bo
44

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

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.
7+
To visually verify that the data has been imported into the MongoDB cluster, click the leaf icon in the left navigation bar of the IDE.
118

12-
Ensure that you see a database called _mongodb_genai_devday_vs_, and a collection named _books_ under it.
9+
Ensure that you see a database called _mongodb_genai_devday_vs_, and a collection named _books_ under it.
1310

14-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-import-data/1-import-data/1-verify-collection.png" alt="Verify collection" />
11+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-import-data/1-import-data/1-verify-collection.png" alt="Verify collection" />
1512

16-
Click the **>** arrow next to _books_ and note the number of documents.
13+
Click the **>** arrow next to _books_ and note the number of documents.
1714

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.
15+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-import-data/1-import-data/2-document-count.png" alt="Verify document count" />
16+
17+
To preview a document, click the **>** arrow next to _Documents_ and select a document from the list.
2118

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>
19+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-import-data/1-import-data/3-preview-document.png" alt="Preview document" />

docs/40-perform-vector-search/2-add-embeddings.mdx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,8 @@ collection.update_one(filter, update)
6060
</div>
6161
</details>
6262

63-
<details>
64-
<summary>🦹 Visually verify that embeddings have been added to the documents in the `books` collection. </summary>
65-
66-
Click on the leaf icon in the left navigation bar of the IDE.
63+
To visually verify that embeddings have been added to the documents in the `books` collection, click on the leaf icon in the left navigation bar of the IDE.
6764

68-
Navigate to a document in the _books_ collection and ensure that it has an `embedding` field.
65+
Navigate to a document in the _books_ collection and ensure that it has an `embedding` field.
6966

70-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-perform-vector-search/2-add-embeddings/1-preview-document.png" alt="Preview document" />
71-
</details>
67+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-perform-vector-search/2-add-embeddings/1-preview-document.png" alt="Preview document" />

docs/40-perform-vector-search/3-create-vector-index.mdx

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,4 @@
22

33
To retrieve documents from MongoDB using vector search, you must configure a vector search index on the collection into which you ingested your data. In this lab, you will programmatically create vector search indexes using MongoDB's Python driver.
44

5-
Fill in any `<CODE_BLOCK_N>` placeholders and run the cells under the **Step 5: Create a vector search index** section in the notebook to create a vector search index on the `books` collection.
6-
7-
The answers for code blocks in this section are as follows:
8-
9-
**CODE_BLOCK_6**
10-
11-
<details>
12-
<summary>Answer</summary>
13-
<div>
14-
15-
```python
16-
collection.create_search_index(model=model)
17-
```
18-
19-
</div>
20-
</details>
5+
Run the cells under the **Step 5: Create a vector search index** section in the notebook to create a vector search index on the `books` collection.

docs/40-perform-vector-search/4-run-vector-search-queries.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Fill in any `<CODE_BLOCK_N>` placeholders and run the cells under the **Step 6:
66

77
The answers for code blocks in this section are as follows:
88

9-
**CODE_BLOCK_7**
9+
**CODE_BLOCK_6**
1010

1111
<details>
1212
<summary>Answer</summary>
@@ -19,7 +19,7 @@ get_embedding(user_query, mode)
1919
</div>
2020
</details>
2121

22-
**CODE_BLOCK_8**
22+
**CODE_BLOCK_7**
2323

2424
<details>
2525
<summary>Answer</summary>
@@ -44,7 +44,7 @@ get_embedding(user_query, mode)
4444
</div>
4545
</details>
4646

47-
**CODE_BLOCK_9**
47+
**CODE_BLOCK_8**
4848

4949
<details>
5050
<summary>Answer</summary>

docs/50-optimizing-vector-search/2-pre-filtering.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Fill in any `<CODE_BLOCK_N>` placeholders and run the cells under the **Step 7:
66

77
The answers for code blocks in this section are as follows:
88

9-
**CODE_BLOCK_10**
9+
**CODE_BLOCK_9**
1010

1111
<details>
1212
<summary>Answer</summary>
@@ -33,7 +33,7 @@ The answers for code blocks in this section are as follows:
3333
</div>
3434
</details>
3535

36-
**CODE_BLOCK_11**
36+
**CODE_BLOCK_10**
3737

3838
<details>
3939
<summary>Answer</summary>
@@ -46,7 +46,7 @@ The answers for code blocks in this section are as follows:
4646
</div>
4747
</details>
4848

49-
**CODE_BLOCK_12**
49+
**CODE_BLOCK_11**
5050

5151
<details>
5252
<summary>Answer</summary>
@@ -74,7 +74,7 @@ The answers for code blocks in this section are as follows:
7474
</div>
7575
</details>
7676

77-
**CODE_BLOCK_13**
77+
**CODE_BLOCK_12**
7878

7979
<details>
8080
<summary>Answer</summary>

docs/50-optimizing-vector-search/3-similarity-functions.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Fill in any `<CODE_BLOCK_N>` placeholders and run the cells under the **Step 8:
88

99
The answers for code blocks in this section are as follows:
1010

11-
**CODE_BLOCK_14**
11+
**CODE_BLOCK_13**
1212

1313
<details>
1414
<summary>Answer</summary>

docs/50-optimizing-vector-search/4-vector-quantization.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Fill in any `<CODE_BLOCK_N>` placeholders and run the cells under the **🦹‍
88

99
The answers for code blocks in this section are as follows:
1010

11-
**CODE_BLOCK_15**
11+
**CODE_BLOCK_14**
1212

1313
<details>
1414
<summary>Answer</summary>
Loading
Loading

0 commit comments

Comments
 (0)