Skip to content

Commit a20f920

Browse files
authored
Merge pull request #12 from Meg528/patch-4
Update 2-sql-vs-aggregation.mdx
2 parents d6cc508 + 358a73e commit a20f920

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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+
:::

0 commit comments

Comments
 (0)