Skip to content
This repository was archived by the owner on Jul 28, 2026. It is now read-only.

Commit 37e098f

Browse files
committed
Merge branch 'main' into consolidate_startup_code
# Conflicts: # javascript/100_aggregation_pipeline_match.ipynb # javascript/101_aggregation_pipeline_arrays.ipynb # javascript/102_aggregation_pipeline_unwind.ipynb # javascript/103_aggregation_pipeline_lookup.ipynb # javascript/104_aggregation_pipeline_group_by.ipynb # javascript/10_find.ipynb # javascript/11_find_arrays.ipynb # javascript/20_project_sort_limit.ipynb # javascript/30_insert.ipynb # javascript/40_delete.ipynb # javascript/50_update.ipynb # javascript/60_indexes.ipynb
2 parents 986318e + 336fc70 commit 37e098f

12 files changed

Lines changed: 74 additions & 57 deletions

‎javascript/00_open_mongodb.ipynb‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,13 @@
4242
}
4343
],
4444
"metadata": {
45+
"kernelspec": {
46+
"display_name": "Deno",
47+
"language": "typescript",
48+
"name": "deno"
49+
},
4550
"language_info": {
46-
"name": "python"
51+
"name": "typescript"
4752
}
4853
},
4954
"nbformat": 4,

‎javascript/01_connect_database.ipynb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"metadata": {},
3232
"outputs": [],
3333
"source": [
34-
"import { MongoClient } from \"npm:mongodb@6.16\";"
34+
"import { MongoClient } from \"npm:mongodb\";"
3535
]
3636
},
3737
{

‎javascript/100_aggregation_pipeline_match.ipynb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"outputs": [],
3434
"source": [
3535
"// Import the MongoDB Driver\n",
36-
"import { MongoClient } from \"npm:mongodb@6.16\";\n",
36+
"import { MongoClient } from \"npm:mongodb\";\n",
3737
"\n",
3838
"// Set your connection String\n",
3939
"const mongoDBURI =\n",

‎javascript/104_aggregation_pipeline_group_by.ipynb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"outputs": [],
3434
"source": [
3535
"// Import the MongoDB Driver\n",
36-
"import { MongoClient } from \"npm:mongodb@6.16\";\n",
36+
"import { MongoClient } from \"npm:mongodb\";\n",
3737
"\n",
3838
"// Set your connection String\n",
3939
"const mongoDBURI =\n",

‎javascript/10_find.ipynb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"outputs": [],
3434
"source": [
3535
"// Import the MongoDB Driver\n",
36-
"import { MongoClient } from \"npm:mongodb@6.16\";\n",
36+
"import { MongoClient } from \"npm:mongodb\";\n",
3737
"\n",
3838
"// Set your connection String\n",
3939
"const mongoDBURI =\n",

‎javascript/200_full_text_search_create_index.ipynb‎

Lines changed: 58 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -22,52 +22,33 @@
2222
"id": "dependent-boundary",
2323
"metadata": {},
2424
"source": [
25-
"## Import the MongoDB Driver"
25+
"## Startup code"
2626
]
2727
},
2828
{
2929
"cell_type": "code",
3030
"execution_count": null,
3131
"id": "66ef28c4-f86b-4576-839e-100a7ae022c7",
3232
"metadata": {},
33-
"outputs": [],
34-
"source": [
35-
"import { MongoClient } from \"npm:mongodb@6.16\";"
36-
]
37-
},
38-
{
39-
"cell_type": "markdown",
40-
"id": "advisory-christmas",
41-
"metadata": {},
42-
"source": [
43-
"## Set your connection String below"
44-
]
45-
},
46-
{
47-
"cell_type": "code",
48-
"execution_count": null,
49-
"id": "urban-boston",
50-
"metadata": {},
51-
"outputs": [],
52-
"source": [
53-
"const mongoDBURI = 'mongodb://admin:mongodb@localhost:27017/?directConnection=true';"
54-
]
55-
},
56-
{
57-
"cell_type": "markdown",
58-
"id": "13926b8c",
59-
"metadata": {},
60-
"source": [
61-
"## Connect to MongoDB"
62-
]
63-
},
64-
{
65-
"cell_type": "code",
66-
"execution_count": null,
67-
"id": "af4eccbc",
68-
"metadata": {},
69-
"outputs": [],
33+
"outputs": [
34+
{
35+
"name": "stdout",
36+
"output_type": "stream",
37+
"text": [
38+
"Connected to MongoDB!\n"
39+
]
40+
}
41+
],
7042
"source": [
43+
"// Import the MongoDB Driver\n",
44+
"import { MongoClient } from \"npm:mongodb\";\n",
45+
"\n",
46+
"// Set your connection String\n",
47+
"const mongoDBURI =\n",
48+
" \"mongodb://admin:mongodb@localhost:27017/?directConnection=true\";\n",
49+
"\n",
50+
"// Define DB and collection\n",
51+
"\n",
7152
"const client = new MongoClient(mongoDBURI);\n",
7253
"\n",
7354
"try {\n",
@@ -77,10 +58,12 @@
7758
" console.error(\"Error connecting to MongoDB:\", error);\n",
7859
"}\n",
7960
"\n",
80-
"\n",
8161
"// Database Name\n",
82-
"const dbName = 'library';\n",
62+
"const dbName = \"library\";\n",
8363
"\n",
64+
"// Define our database and collection. \n",
65+
"// We'll use the `library` variable that points to our Database and \n",
66+
"// `books` that points to the collection we're using.\n",
8467
"const db = client.db(dbName);\n",
8568
"const books = db.collection(\"books\");"
8669
]
@@ -90,17 +73,28 @@
9073
"id": "handled-symbol",
9174
"metadata": {},
9275
"source": [
93-
"### createSearchIndex\n",
76+
"## createSearchIndex\n",
9477
"\n",
9578
"https://www.mongodb.com/docs/manual/reference/method/db.collection.createSearchIndex/"
9679
]
9780
},
9881
{
9982
"cell_type": "code",
100-
"execution_count": null,
83+
"execution_count": 3,
10184
"id": "african-maple",
10285
"metadata": {},
103-
"outputs": [],
86+
"outputs": [
87+
{
88+
"data": {
89+
"text/plain": [
90+
"\u001b[32m\"default\"\u001b[39m"
91+
]
92+
},
93+
"execution_count": 3,
94+
"metadata": {},
95+
"output_type": "execute_result"
96+
}
97+
],
10498
"source": [
10599
"await books.createSearchIndex(\n",
106100
" { name: \"default\", \n",
@@ -121,10 +115,28 @@
121115
},
122116
{
123117
"cell_type": "code",
124-
"execution_count": null,
118+
"execution_count": 4,
125119
"id": "8319f972",
126120
"metadata": {},
127-
"outputs": [],
121+
"outputs": [
122+
{
123+
"name": "stdout",
124+
"output_type": "stream",
125+
"text": [
126+
"Indexes: [\n",
127+
" {\n",
128+
" id: \"6849a3c43ed54073e13e115f\",\n",
129+
" name: \"default\",\n",
130+
" type: \"search\",\n",
131+
" status: \"READY\",\n",
132+
" queryable: true,\n",
133+
" latestVersion: 0,\n",
134+
" latestDefinition: { mappings: { dynamic: true, fields: {} } }\n",
135+
" }\n",
136+
"]\n"
137+
]
138+
}
139+
],
128140
"source": [
129141
"// list all Atlas Search indexes for the collection\n",
130142
"const indexes = await books.listSearchIndexes().toArray();\n",
@@ -153,7 +165,7 @@
153165
"name": "typescript",
154166
"nbconvert_exporter": "script",
155167
"pygments_lexer": "typescript",
156-
"version": "5.7.3"
168+
"version": "5.8.3"
157169
}
158170
},
159171
"nbformat": 4,

‎javascript/20_project_sort_limit.ipynb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"outputs": [],
3434
"source": [
3535
"// Import the MongoDB Driver\n",
36-
"import { MongoClient } from \"npm:mongodb@6.16\";\n",
36+
"import { MongoClient } from \"npm:mongodb\";\n",
3737
"\n",
3838
"// Set your connection String\n",
3939
"const mongoDBURI =\n",

‎javascript/210_full_text_search.ipynb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"metadata": {},
3333
"outputs": [],
3434
"source": [
35-
"import { MongoClient } from \"npm:mongodb@6.16\";"
35+
"import { MongoClient } from \"npm:mongodb\";"
3636
]
3737
},
3838
{

‎javascript/30_insert.ipynb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"outputs": [],
3434
"source": [
3535
"// Import the MongoDB Driver\n",
36-
"import { MongoClient } from \"npm:mongodb@6.16\";\n",
36+
"import { MongoClient } from \"npm:mongodb\";\n",
3737
"\n",
3838
"// Set your connection String\n",
3939
"const mongoDBURI =\n",

‎javascript/40_delete.ipynb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"outputs": [],
3434
"source": [
3535
"// Import the MongoDB Driver\n",
36-
"import { MongoClient } from \"npm:mongodb@6.16\";\n",
36+
"import { MongoClient } from \"npm:mongodb\";\n",
3737
"\n",
3838
"// Set your connection String\n",
3939
"const mongoDBURI =\n",

0 commit comments

Comments
 (0)