GeorgiosIoannouCoder
commited on
Commit
•
3c34409
1
Parent(s):
77cd2ef
Update mongodb_atlas_vector_search_setup.md
Browse files
mongodb_atlas_vector_search_setup.md
CHANGED
@@ -1,73 +1,79 @@
|
|
1 |
-
# Author : Georgios Ioannou
|
2 |
-
#
|
3 |
-
# Copyright © 2024 by Georgios Ioannou
|
4 |
-
|
5 |
-
# Setting Up MongoDB with Atlas Vector Search
|
6 |
-
|
7 |
-
## Initial Setup
|
8 |
-
1. Create and log in to your MongoDB account at [mongodb.com](https://mongodb.com)
|
9 |
-
|
10 |
-
2. Create Organization and Project
|
11 |
-
-
|
12 |
-
-
|
13 |
-
-
|
14 |
-
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
-
|
27 |
-
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
-
|
32 |
-
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
-
|
40 |
-
-
|
41 |
-
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
"
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
- Replace `<password>` with your database user password
|
|
|
1 |
+
# Author : Georgios Ioannou
|
2 |
+
#
|
3 |
+
# Copyright © 2024 by Georgios Ioannou
|
4 |
+
|
5 |
+
# Setting Up MongoDB with Atlas Vector Search
|
6 |
+
|
7 |
+
## Initial Setup
|
8 |
+
1. Create and log in to your MongoDB account at [mongodb.com](https://mongodb.com)
|
9 |
+
|
10 |
+
2. Create Organization and Project
|
11 |
+
- Note that
|
12 |
+
- Create a new MongoDB organization
|
13 |
+
- Name your organization as desired
|
14 |
+
- Create a new MongoDB project
|
15 |
+
- Name your project as desired
|
16 |
+
|
17 |
+
3. Create Cluster
|
18 |
+
- Select M0 (FREE) tier
|
19 |
+
- Make sure to uncheck "Preload sample dataset"
|
20 |
+
- Keep everything else default.
|
21 |
+
- Wait 1-3 minutes for cluster creation
|
22 |
+
|
23 |
+
## Security Setup
|
24 |
+
4. Create Database User
|
25 |
+
- Create username and password
|
26 |
+
- Then, click on continue.
|
27 |
+
- Then, just close no need to choose a connection method.
|
28 |
+
- **Important**: Save these credentials securely
|
29 |
+
|
30 |
+
5. Configure Network Access
|
31 |
+
- Navigate on the left menu to Security -> Network Access
|
32 |
+
- Add IP Address: `0.0.0.0/0` (Allows access from anywhere)
|
33 |
+
|
34 |
+
## Database Creation
|
35 |
+
6. Set Up Database and Collection
|
36 |
+
- Click "Clusters" on the left under "Database".
|
37 |
+
- Click "Browse Collections"
|
38 |
+
- Click "Add My Own Data"
|
39 |
+
- Create database (e.g., "txts")
|
40 |
+
- Create collection (e.g., "txts_collection")
|
41 |
+
- Click "Create"
|
42 |
+
|
43 |
+
## Vector Search Configuration
|
44 |
+
7. Create Vector Search Index
|
45 |
+
- Click "Search Indexes" (This will bring you to "Atlas Search" tab)
|
46 |
+
- Click "Create Search Index"
|
47 |
+
- Select "JSON Editor" under "Atlas Vector Search"
|
48 |
+
- Click "Next"
|
49 |
+
- Configure index settings:
|
50 |
+
```json
|
51 |
+
{
|
52 |
+
"name": "vector_index", // Adjust it to your desired name.
|
53 |
+
"type": "vector",
|
54 |
+
"path": "embedding", // Adjust it to your index/embedding column.
|
55 |
+
"numDimensions": 384, // Adjust based on your model. (e.g., 384 for all-MiniLM-l6-v2)
|
56 |
+
"similarity": "euclidean" // Adjust it to your desired similarity function.
|
57 |
+
}
|
58 |
+
```
|
59 |
+
- Optional: Add filter fields if needed:
|
60 |
+
```json
|
61 |
+
{
|
62 |
+
"type": "filter",
|
63 |
+
"path": "source" // Adjust it to the column you would like to filter with.
|
64 |
+
}
|
65 |
+
```
|
66 |
+
- Assign your index to the collection name created in step 6 using the drop down menu on the left.
|
67 |
+
- Click "Next"
|
68 |
+
- Click "Create Search Index"
|
69 |
+
- Wait for status to change from "Pending" to "Active"
|
70 |
+
|
71 |
+
**Note**: While vector search index creation can be done programmatically, the GUI method described above is recommended for simplicity.
|
72 |
+
|
73 |
+
## Connection String
|
74 |
+
8. Get Your MongoDB URI
|
75 |
+
- Click "Clusters" under DATABASE on the left menu
|
76 |
+
- Click "Connect" next to name of your cluster
|
77 |
+
- Select "Drivers"
|
78 |
+
- Copy the connection/MongoURI string at the very end of the modal that just opened
|
79 |
- Replace `<password>` with your database user password
|