Skip to content

Commit bd691fd

Browse files
authored
Merge pull request #14 from mongodb-developer/review-nyc-fixes
Review nyc fixes
2 parents f1a48c6 + 0f5e8b7 commit bd691fd

16 files changed

+95
-89
lines changed

javascript/00_open_mongodb.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
"- admin\n",
2525
"- config\n",
2626
"- local\n",
27-
"- library -> __we're going to work with this one__\n",
28-
"- library_with_embedding -> same data, but books have vector embedding for vector search"
27+
"- library -> __we're going to work with this one__"
2928
]
3029
},
3130
{

javascript/01_connect_database.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"metadata": {},
3232
"outputs": [],
3333
"source": [
34-
"import { MongoClient } from \"npm:mongodb\";"
34+
"import { MongoClient } from \"npm:mongodb@6.19.0\";"
3535
]
3636
},
3737
{
@@ -161,7 +161,7 @@
161161
"name": "typescript",
162162
"nbconvert_exporter": "script",
163163
"pygments_lexer": "typescript",
164-
"version": "5.7.3"
164+
"version": "5.9.2"
165165
}
166166
},
167167
"nbformat": 4,

javascript/100_aggregation_pipeline_match.ipynb

Lines changed: 2 additions & 2 deletions
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\";\n",
36+
"import { MongoClient } from \"npm:mongodb@6.19.0\";\n",
3737
"\n",
3838
"// Set your connection String\n",
3939
"const mongoDBURI =\n",
@@ -236,7 +236,7 @@
236236
"name": "typescript",
237237
"nbconvert_exporter": "script",
238238
"pygments_lexer": "typescript",
239-
"version": "5.8.3"
239+
"version": "5.9.2"
240240
}
241241
},
242242
"nbformat": 4,

javascript/101_aggregation_pipeline_arrays.ipynb

Lines changed: 24 additions & 16 deletions
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@6.19.0\";\n",
3737
"\n",
3838
"// Set your connection String\n",
3939
"const mongoDBURI =\n",
@@ -79,13 +79,17 @@
7979
"source": [
8080
"// Aggregation pipeline\n",
8181
"const pipeline = [\n",
82-
" { $match: {\n",
83-
" 'genre.name': { $all: ['Police', 'Fiction'] }\n",
84-
" } },\n",
85-
" { $project: {\n",
86-
" title: 1,\n",
87-
" genre: 1\n",
88-
" } }\n",
82+
" {\n",
83+
" $match: {\n",
84+
" genres: { $all: [\"Police\", \"Fiction\"] },\n",
85+
" },\n",
86+
" },\n",
87+
" {\n",
88+
" $project: {\n",
89+
" title: 1,\n",
90+
" genre: 1,\n",
91+
" },\n",
92+
" },\n",
8993
"];\n",
9094
"\n",
9195
"// Execute the aggregate operation\n",
@@ -114,13 +118,17 @@
114118
"source": [
115119
"// Aggregate pipeline\n",
116120
"const pipeline = [\n",
117-
" { $match: {\n",
118-
" 'genre.name': { $in: ['Police', 'Fiction'] }\n",
119-
" } },\n",
120-
" { $project: {\n",
121-
" title: 1,\n",
122-
" genre: 1\n",
123-
" } }\n",
121+
" {\n",
122+
" $match: {\n",
123+
" genres: { $in: [\"Police\", \"Fiction\"] },\n",
124+
" },\n",
125+
" },\n",
126+
" {\n",
127+
" $project: {\n",
128+
" title: 1,\n",
129+
" genre: 1,\n",
130+
" },\n",
131+
" },\n",
124132
"];\n",
125133
"\n",
126134
"// Execute the aggregate operation\n",
@@ -146,7 +154,7 @@
146154
"name": "typescript",
147155
"nbconvert_exporter": "script",
148156
"pygments_lexer": "typescript",
149-
"version": "5.8.3"
157+
"version": "5.9.2"
150158
}
151159
},
152160
"nbformat": 4,

javascript/102_aggregation_pipeline_unwind.ipynb

Lines changed: 14 additions & 10 deletions
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@6.19.0\";\n",
3737
"\n",
3838
"// Set your connection String\n",
3939
"const mongoDBURI =\n",
@@ -78,14 +78,18 @@
7878
"source": [
7979
"// Aggregation pipeline\n",
8080
"const pipeline = [\n",
81-
" { $match: {\n",
82-
" \"_id\": \"60187778\"\n",
83-
" } },\n",
84-
" { $unwind: \"$attributes\" },\n",
85-
" { $project: {\n",
86-
" title: 1,\n",
87-
" attributes: 1\n",
88-
" } }\n",
81+
" {\n",
82+
" $match: {\n",
83+
" _id: \"0060930284\",\n",
84+
" },\n",
85+
" },\n",
86+
" { $unwind: \"$attributes\" },\n",
87+
" {\n",
88+
" $project: {\n",
89+
" title: 1,\n",
90+
" attributes: 1,\n",
91+
" },\n",
92+
" },\n",
8993
"];\n",
9094
"\n",
9195
"// Execute the aggregate operation\n",
@@ -111,7 +115,7 @@
111115
"name": "typescript",
112116
"nbconvert_exporter": "script",
113117
"pygments_lexer": "typescript",
114-
"version": "5.8.3"
118+
"version": "5.9.2"
115119
}
116120
},
117121
"nbformat": 4,

javascript/103_aggregation_pipeline_lookup.ipynb

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"id": "3b936925-e295-489a-b508-2b99c0160217",
1414
"metadata": {},
1515
"source": [
16-
"# Aggregation Pipeline\n",
16+
"# Aggregation Pipeline - $lookup\n",
1717
" "
1818
]
1919
},
@@ -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@6.19.0\";\n",
3737
"\n",
3838
"// Set your connection String\n",
3939
"const mongoDBURI =\n",
@@ -77,14 +77,23 @@
7777
"source": [
7878
"// Aggregation pipeline\n",
7979
"const pipeline = [\n",
80-
" {$lookup: {\n",
81-
" from: \"books\", // read from books collection\n",
82-
" localField: \"books\", // authors have a books array with books ids\n",
83-
" foreignField: \"_id\", // join using the _id field\n",
84-
" as: \"booksWritten\" // add a new field with the results\n",
85-
" } },\n",
86-
" {$limit: 10},\n",
87-
" {$project: {_id: 0}}\n",
80+
" {\n",
81+
" $lookup: {\n",
82+
" from: \"books\", // read from books collection\n",
83+
" localField: \"books\", // authors have a books array with books ids\n",
84+
" foreignField: \"_id\", // join using the _id field\n",
85+
" as: \"booksWritten\", // add a new field with the results\n",
86+
" },\n",
87+
" },\n",
88+
" { $limit: 10 },\n",
89+
" {\n",
90+
" $project: {\n",
91+
" _id: 0,\n",
92+
" title: 1,\n",
93+
" books: 1,\n",
94+
" booksWritten: 1,\n",
95+
" },\n",
96+
" },\n",
8897
"];\n",
8998
"\n",
9099
"// Execute the aggregate operation\n",
@@ -110,7 +119,7 @@
110119
"name": "typescript",
111120
"nbconvert_exporter": "script",
112121
"pygments_lexer": "typescript",
113-
"version": "5.8.3"
122+
"version": "5.9.2"
114123
}
115124
},
116125
"nbformat": 4,

javascript/104_aggregation_pipeline_group_by.ipynb

Lines changed: 2 additions & 2 deletions
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\";\n",
36+
"import { MongoClient } from \"npm:mongodb@6.19.0\";\n",
3737
"\n",
3838
"// Set your connection String\n",
3939
"const mongoDBURI =\n",
@@ -144,7 +144,7 @@
144144
"name": "typescript",
145145
"nbconvert_exporter": "script",
146146
"pygments_lexer": "typescript",
147-
"version": "5.8.3"
147+
"version": "5.9.2"
148148
}
149149
},
150150
"nbformat": 4,

javascript/10_find.ipynb

Lines changed: 5 additions & 5 deletions
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\";\n",
36+
"import { MongoClient } from \"npm:mongodb@6.19.0\";\n",
3737
"\n",
3838
"// Set your connection String\n",
3939
"const mongoDBURI =\n",
@@ -176,7 +176,7 @@
176176
"metadata": {},
177177
"outputs": [],
178178
"source": [
179-
"// type in your code here, you'll need to adapt the code a bit\n"
179+
"// type in your code here\n"
180180
]
181181
},
182182
{
@@ -196,7 +196,7 @@
196196
"metadata": {},
197197
"outputs": [],
198198
"source": [
199-
"// type in your code here, you'll need to adapt the code a bit\n"
199+
"// type in your code here\n"
200200
]
201201
},
202202
{
@@ -216,7 +216,7 @@
216216
"metadata": {},
217217
"outputs": [],
218218
"source": [
219-
"// type in your code here, you'll need to adapt the code a bit\n"
219+
"// type in your code here\n"
220220
]
221221
}
222222
],
@@ -233,7 +233,7 @@
233233
"name": "typescript",
234234
"nbconvert_exporter": "script",
235235
"pygments_lexer": "typescript",
236-
"version": "5.8.3"
236+
"version": "5.9.2"
237237
}
238238
},
239239
"nbformat": 4,

javascript/11_find_arrays.ipynb

Lines changed: 9 additions & 9 deletions
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@6.19.0\";\n",
3737
"\n",
3838
"// Set your connection String\n",
3939
"const mongoDBURI =\n",
@@ -76,7 +76,7 @@
7676
"outputs": [],
7777
"source": [
7878
"const cursor = await books.find(\n",
79-
"\t{ \"genre.name\": \"Poetry\"}\n",
79+
"\t{ \"genres\": \"Poetry\"}\n",
8080
")\n",
8181
"\n",
8282
"await cursor.forEach((book) => {\n",
@@ -100,15 +100,15 @@
100100
"outputs": [],
101101
"source": [
102102
"const cursor = await books.find(\n",
103-
"\t{ \"genre.name\": { $all: [\n",
104-
" \"Poetry\",\n",
103+
"\t{ \"genres\": { $all: [\n",
104+
" \"Family Life\",\n",
105105
" \"Fiction\"\n",
106106
" ]}\n",
107107
" }\n",
108108
")\n",
109109
"\n",
110110
"await cursor.forEach((book) => {\n",
111-
" console.log(book.title + \" - \" + JSON.stringify(book.genre));\n",
111+
" console.log(book.title + \" - \" + JSON.stringify(book.genres));\n",
112112
"});\n"
113113
]
114114
},
@@ -128,15 +128,15 @@
128128
"outputs": [],
129129
"source": [
130130
"const cursor = await books.find(\n",
131-
"\t{ \"genre.name\": { $in: [\n",
131+
"\t{ \"genres\": { $in: [\n",
132132
" \"Poetry\",\n",
133133
" \"Fiction\"\n",
134134
" ]}\n",
135135
" }\n",
136136
")\n",
137137
"\n",
138138
"await cursor.forEach((book) => {\n",
139-
" console.log(book.title + \" - \" + JSON.stringify(book.genre));\n",
139+
" console.log(book.title + \" - \" + JSON.stringify(book.genres));\n",
140140
"});"
141141
]
142142
},
@@ -158,7 +158,7 @@
158158
"outputs": [],
159159
"source": [
160160
"const cursor = await books.find(\n",
161-
"\t{ \"genre.name\": [\n",
161+
"\t{ \"genres\": [\n",
162162
" \"Poetry\",\n",
163163
" \"Fiction\"\n",
164164
" ]}\n",
@@ -183,7 +183,7 @@
183183
"name": "typescript",
184184
"nbconvert_exporter": "script",
185185
"pygments_lexer": "typescript",
186-
"version": "5.8.3"
186+
"version": "5.9.2"
187187
}
188188
},
189189
"nbformat": 4,

javascript/200_full_text_search_create_index.ipynb

Lines changed: 2 additions & 10 deletions
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\";\n",
36+
"import { MongoClient } from \"npm:mongodb@6.19.0\";\n",
3737
"\n",
3838
"// Set your connection String\n",
3939
"const mongoDBURI =\n",
@@ -105,14 +105,6 @@
105105
"const indexes = await books.listSearchIndexes().toArray();\n",
106106
"console.log(\"Indexes:\", indexes);"
107107
]
108-
},
109-
{
110-
"cell_type": "code",
111-
"execution_count": null,
112-
"id": "219aae92",
113-
"metadata": {},
114-
"outputs": [],
115-
"source": []
116108
}
117109
],
118110
"metadata": {
@@ -128,7 +120,7 @@
128120
"name": "typescript",
129121
"nbconvert_exporter": "script",
130122
"pygments_lexer": "typescript",
131-
"version": "5.8.3"
123+
"version": "5.9.2"
132124
}
133125
},
134126
"nbformat": 4,

0 commit comments

Comments
 (0)