Skip to content

Commit 8a737c1

Browse files
authored
Merge branch 'main' into patch-8
2 parents 3f23189 + 308aebb commit 8a737c1

File tree

10 files changed

+50
-52
lines changed

10 files changed

+50
-52
lines changed

docs/1-mongodb-atlas/setup-lab.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
description: Setting up your MongoDB Atlas account, importing Library data
33
---
44

5-
# 👐 Set up Lab
5+
# 👐 Set Up Lab
66

7-
To follow along you'll need:
8-
- a MongoDB Atlas account
9-
- test data. In this case, this is books, authors and reviews data for a library management system.
7+
To follow along, you'll need:
8+
- A MongoDB Atlas account.
9+
- Test data. In this case, this is book, author, and review data for a library management system.
1010

11-
👐 To get both, open the [Intro Lab](https://mongodb-developer.github.io/intro-lab/docs/intro) and follow it (only takes 10-15 mins) to get your database ready. Return here when finished!
11+
👐 To get both, open the [intro lab](https://mongodb-developer.github.io/intro-lab/docs/intro) and follow it (only takes 10-15 mins) to get your database ready. Return here when finished!
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
---
2-
description: Learn what is an Aggregation Pipeline
2+
description: Learn what an aggregation pipeline is.
33
---
44

5-
# 📘 What is an Aggregation Pipeline
5+
# 📘 What is an Aggregation Pipeline?
66

77
![](/img/20-what-is-aggregation/aggregation-pipeline.png)
88

9-
An Aggregation Pipeline is similar to unix commands connected using pipes.
10-
We can Construct modular, composable processing pipelines.
9+
An aggregation pipeline is similar to unix commands connected using pipes. We can construct modular, composable processing pipelines.
1110

12-
An aggregation pipeline consists of one or more _stages_ that processes documents:
11+
An aggregation pipeline consists of one or more _stages_ that process documents:
1312

1413
Each stage performs an operation on the input documents. For example, a stage can filter documents, group documents, and calculate values.
1514

1615
The documents that are the output of a stage are passed as the input to the next stage.
1716

18-
An aggregation pipeline can return results for groups of documents. For example, return the total, average, maximum, and minimum values, etc.
17+
An aggregation pipeline can return results for groups of documents. For example, return the total, average, maximum, and minimum values, etc.

docs/20-what-is-aggregation/2-sql-vs-aggregation.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
2-
description: Let's compare SQL with an Aggregation Pipeline
2+
description: Let's compare SQL with an aggregation pipeline.
33
---
44

55
# 📘 SQL vs Aggregations
66

77
## SQL
88

9-
A SQL query statement usually starts with a `SELECT` where we put a list of the fields we need, then a `FROM` clause to state the table/s (or as in this case the subquery) that will return the rows. We can filter out using `WHERE` and group data using `GROUP`.
9+
A SQL query statement usually starts with a `SELECT` where we put a list of the fields we need, then a `FROM` clause to state the table/s (or in this case, the subquery) that will return the rows. We can filter out using `WHERE` and group data using `GROUP`.
1010

11-
We read this from the inside. If there's too much nesting is not easy to follow.
11+
We read this from the inside. If there's too much nesting, it's not easy to follow.
1212

1313
```SQL
1414
SELECT
@@ -33,9 +33,9 @@ FROM (
3333
GROUP BY city;
3434
```
3535

36-
## Equivalent MongoDB Aggregation Pipeline
36+
## Equivalent MongoDB aggregation pipeline
3737

38-
Here we pass three stages, one to return one document per element in the `address` array, then we filter out to get only the documents that have a `home` address location and finally we do the grouping. As we'll see, this can be split and tested separately, and resembles our code.
38+
Here we pass three stages: one to return one document per element in the `address` array, and then we filter out to get only the documents that have a `home` address location. Finally, we do the grouping. As we'll see, this can be split and tested separately and resembles our code.
3939

4040
```js
4141
db.customers.aggregate([
@@ -59,4 +59,4 @@ db.customers.aggregate([
5959

6060
:::info
6161
See also [SQL to Aggregation Mapping Chart](https://www.mongodb.com/docs/manual/reference/sql-aggregation-comparison/)
62-
:::
62+
:::

docs/20-what-is-aggregation/3-structure-aggregation.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
description: See the parts that compose an Aggregation Pipeline
2+
description: See the parts that compose an aggregation pipeline.
33
---
44

5-
# 📘 Structure of an aggregation pipeline
5+
# 📘 Structure of an Aggregation Pipeline
66

7-
To interact with a relational database we typically use SQL, a 4th Generation language to access our data. With MongoDB we instead get data and transform it in incremental steps.
7+
To interact with a relational database, we typically use SQL, a 4th-generation language, to access our data. With MongoDB, we instead get data and transform it in incremental steps.
88

99
An aggregation pipeline is composed of [__stages__](https://www.mongodb.com/docs/manual/reference/operator/aggregation-pipeline/).
1010

@@ -20,7 +20,7 @@ db.mycollection.aggregate([
2020

2121
## Example
2222

23-
An Aggregation Pipeline that does the same than above SQL statement could be:
23+
An aggregation pipeline that does the same as the above SQL statement could be:
2424

2525
```
2626
db.mycollection.aggregate([
@@ -63,4 +63,4 @@ db.mycollection.aggregate([
6363
},
6464
},
6565
])
66-
```
66+
```

docs/30-simple-queries/0-using-library-database.mdx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import Tabs from '@theme/Tabs';
22
import TabItem from '@theme/TabItem';
33

4-
# 👐 Using the library database
4+
# 👐 Using the Library Database
55

66
## Select the library database
77

8-
💻 We'll use the `library` database for all of the hands-on exercises in this lab.
9-
If you haven't already, import the [library data](https://mdb.link/import-library-data) into your database cluster.
8+
💻 We'll use the `library` database for all of the hands-on exercises in this lab. If you haven't already, import the [library data](https://mdb.link/import-library-data) into your database cluster.
109

1110
<Tabs groupId="aggregations">
1211
<TabItem value="atlas" label="Atlas UI">
@@ -19,13 +18,13 @@ Select the correct database in the aggregation pipeline builder.
1918
</TabItem>
2019
<TabItem value="mongodb-shell" label="MongoDB Shell">
2120

22-
To do that, in a MongoDB shell type in:
21+
To do that, in a MongoDB shell, type:
2322

2423
```js
2524
use library
2625
```
2726

28-
You can show all collections with
27+
You can show all collections with:
2928

3029
```js
3130
show collections
@@ -36,7 +35,7 @@ show collections
3635
🦸‍♂️ 💻 How would you switch to a database called `orders`?
3736

3837
:::info
39-
Extra activity, do it if you have extra time or are following at home, won't be covered during the hands-on lab.
38+
Extra activity! Do it if you have extra time or are following along at home. It won't be covered during the hands-on lab.
4039
:::
4140

4241
<details>
@@ -47,7 +46,7 @@ Extra activity, do it if you have extra time or are following at home, won't be
4746
use orders
4847
```
4948

50-
Even if this database does not yet exists, MongoDB can change to it. If we create a collection, users, etc. then this DB will get created.
49+
Even if this database does not yet exist, MongoDB can change to it. If we create a collection, users, etc., then this DB will be created.
5150

5251
Remember to get back to the library database by using:
5352

@@ -57,13 +56,13 @@ use library
5756
</div>
5857
</details>
5958

60-
## 🦸‍♂️ Showing all Databases
59+
## 🦸‍♂️ Showing all databases
6160

6261
:::info
63-
Extra activity, do it if you have extra time or are following at home, won't be covered during the hands-on Lab
62+
Extra activity! Do it if you have extra time or are following along at home. It won't be covered during the hands-on lab.
6463
:::
6564

66-
You can also list other databases in your MongoDB instance with
65+
You can also list other databases in your MongoDB instance with:
6766

6867
```js
6968
show databases

docs/30-simple-queries/1-empty-aggregation.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import Tabs from '@theme/Tabs';
22
import TabItem from '@theme/TabItem';
33

4-
# 👐 Empty aggregation pipeline
4+
# 👐 Empty Aggregation Pipeline
55

66
## An empty aggregation
77

8-
This code is the equivalent to a `SELECT * FROM AUTHORS`. Returns a [cursor](https://www.mongodb.com/docs/manual/reference/method/js-cursor/) with all documents in the `authors` collection:
8+
This code is the equivalent of a `SELECT * FROM AUTHORS`. It returns a [cursor](https://www.mongodb.com/docs/manual/reference/method/js-cursor/) with all documents in the `authors` collection:
99

1010
<Tabs groupId="aggregations">
1111

@@ -29,7 +29,7 @@ This code is the equivalent to a `SELECT * FROM AUTHORS`. Returns a [cursor](htt
2929
db.authors.aggregate([])
3030
```
3131

32-
We can iterate over the returned cursor and get more documents typing `it`.
32+
We can iterate over the returned cursor and get more documents by typing `it`.
3333

3434
👐 Return all the documents in the `books` collection and iterate to get the next page of books.
3535

@@ -47,10 +47,10 @@ it
4747
## 🦸‍♂️ Cursor methods
4848

4949
:::info
50-
Extra activity, do it if you have extra time or are following at home, won't be covered during the hands-on Lab
50+
Extra activity! Do it if you have extra time or are following along at home. It won't be covered during the hands-on lab.
5151
:::
5252

53-
A [cursor](https://www.mongodb.com/docs/manual/reference/method/js-cursor/) has several useful methods, for instance we can check the size of the returned cursor with `itcount`
53+
A [cursor](https://www.mongodb.com/docs/manual/reference/method/js-cursor/) has several useful methods. For instance, we can check the size of the returned cursor with `itcount`.
5454

5555
```js
5656
cursor.itcount()

docs/30-simple-queries/2-match.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ The `<expression>` portion of the $match operator can be any valid MongoDB expre
2020

2121
## Matching book documents
2222

23-
<Tabs groupId="aggregations-year">
23+
<Tabs groupId="aggregations">
2424
<TabItem value="atlas" label="Atlas UI">
2525

2626
First, make sure you select the `books` collection in the Atlas UI.
2727
<Screenshot src="/img/30-simple-queries/select-books-collection.png" url="http://cloud.mongodb.com/" alt="Atlas UI database deployment with the books collection highlighted." />
2828

29-
Then, navigate to the `Aggregation` tab and click `Add Stage`.
29+
Then, navigate to the `Aggregation` tab and click `</> TEXT`.
3030
<Screenshot src="/img/30-simple-queries/new-aggregation.png" url="http://cloud.mongodb.com/" alt="Atlas UI database deployment with aggregation tab highlighted." />
3131

3232
Say we want all the books from the year 2010. We can add a `$match` stage to filter the documents from the books collection:
@@ -58,7 +58,7 @@ The `<expression>` portion of the $match operator can be any valid MongoDB expre
5858
<summary>Answer</summary>
5959
<div>
6060

61-
<Tabs groupId="aggregations-pages">
61+
<Tabs groupId="aggregations">
6262
<TabItem value="atlas" label="Atlas UI">
6363
```js
6464
[
@@ -86,7 +86,7 @@ If we need to add more conditions using AND, we can do it with the `$and` operat
8686

8787
If we want all the books with 100 pages with exactly `totalInventory` 2, we can use a `$and` operator. This takes an array of documents with all the conditions that should be true for the AND to succeed:
8888

89-
<Tabs groupId="aggregations-and">
89+
<Tabs groupId="aggregations">
9090
<TabItem value="atlas" label="Atlas UI">
9191
```js
9292
[
@@ -187,7 +187,7 @@ db.books.aggregate([{$match: {$and: [{pages: 100}, {year: 2015}]}}]).itcount()
187187

188188
We can do an implicit AND just passing a document with all the conditions (instead of an array of documents):
189189

190-
<Tabs groupId="aggregations-shorthand-and">
190+
<Tabs groupId="aggregations">
191191
<TabItem value="atlas" label="Atlas UI">
192192
```js
193193
[
@@ -211,7 +211,7 @@ db.books.aggregate([{$match: {pages: 100, totalInventory: 2}}])
211211
<summary>Answer</summary>
212212
<div>
213213

214-
<Tabs groupId="aggregations-shorthand-and-exercise">
214+
<Tabs groupId="aggregations">
215215
<TabItem value="atlas" label="Atlas UI">
216216
```js
217217
[

docs/30-simple-queries/3-project.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ A document from the `books` collection looks like:
6262
If we're interested just in the titles, we can use `$project` to select just the fields we're interested in. As an example, to get just the book's title and year we'll write:
6363

6464

65-
<Tabs groupId="project">
65+
<Tabs groupId="aggregations">
6666
<TabItem value="atlas" label="Atlas UI">
6767
```js
6868
[

docs/40-using-arrays/2-search-inside-objects-in-arrays.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 👐 Searching inside Objects in arrays
22

3-
In our books we're using the [Attribute Pattern](https://www.mongodb.com/developer/products/mongodb/attribute-pattern/) to have different attributes in our documents. As we can see in the [sample doc](/docs/simple-queries/project) we have an `attributes` array, containing several objects, each with the same structure:
3+
In the books collection, we're using the [Attribute Pattern](https://www.mongodb.com/developer/products/mongodb/attribute-pattern/) to store different attributes in our documents. As we can see in the [sample doc](/docs/simple-queries/project), we have an `attributes` array, containing several objects, each with the same structure:
44

55
```js
66
attributes: [

docs/intro.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ sidebar_position: 0
77
import Tabs from '@theme/Tabs';
88
import TabItem from '@theme/TabItem';
99

10-
|Lab goals|Learn about Aggregation Pipelines writing Aggregation Pipelines|
10+
|Lab goals|Learn about aggregation pipelines writing aggregation pipelines|
1111
|-|-|
12-
|What you'll learn|What are Aggregation Pipelines |
13-
||How are they different from simple MongoDB queries or SQL|
12+
|What you'll learn|What are aggregation pipelines? |
13+
||How are they different from simple MongoDB queries or SQL?|
1414
||How to use simple pipelines to get data, filter it, show the fields needed|
1515
||How to write more advanced pipelines, querying arrays, counting and sorting results|
1616
||How to do JOINs using $lookup|
@@ -19,11 +19,11 @@ import TabItem from '@theme/TabItem';
1919
||How to write aggregations using popular programming languages (TBD)|
2020
|Time to complete|90 mins|
2121

22-
In the navigation bar and in some pages, you will notice some icons. Here is their meaning:
22+
In the navigation bar and on some pages, you will notice some icons. Here are their meanings:
2323

2424
|Icon|Meaning|
2525
|-|:-|
26-
|📘|Lecture material - If you're following along in an instructor lead session, they probably have covered this already.|
26+
|📘|Lecture material - If you're following along in an instructor-led session, they probably have covered this already.|
2727
|👐|Hands-on content - Get ready to get some work done. You should follow these steps.|
28-
|💬|Discussion - Item to discuss during the Lab|
29-
|🦸|Advanced content - This content isn't covered during the lab, but if you're interested in learning more, you can check it out.|
28+
|💬|Discussion - Item to discuss during the lab|
29+
|🦸|Advanced content - This content isn't covered during the lab, but if you're interested in learning more, you can check it out.|

0 commit comments

Comments
 (0)