You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/50-aggregation/5-JOIN.mdx
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ db.authors.aggregate([
47
47
]);
48
48
```
49
49
50
-
### **Equivalent SQL Query**
50
+
### **Equivalent SQL query**
51
51
52
52
```sql
53
53
SELECT books.*, authors.*
@@ -61,11 +61,11 @@ The result in MongoDB will have an array (`authorDetails`) instead of flat colum
61
61
62
62
---
63
63
64
-
## 🔹 Handling Unwinding ($unwind)
64
+
## 🔹 Handling unwinding ($unwind)
65
65
66
66
Since `$lookup` produces an **array**, we can flatten it using `$unwind`.
67
67
68
-
### Example 2: Get Only Book Titles and Single Author Name
68
+
### Example 2: Get only book titles and single author name
69
69
70
70
```js
71
71
db.authors.aggregate([
@@ -83,7 +83,7 @@ db.authors.aggregate([
83
83
```
84
84
85
85
:::info
86
-
The $lookup operation creates an array within each book document. Using $unwind then flattens this array, resulting in a separate document for every single book - author pair.
86
+
The $lookup operation creates an array within each book document. Using $unwind then flattens this array, resulting in a separate document for every single book-author pair.
0 commit comments