Skip to content

Commit fce1bbd

Browse files
authored
Merge pull request #27 from Meg528/patch-19
Update 1-lookups.mdx
2 parents f46aeaa + c8bbbb1 commit fce1bbd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/60-lookups/1-lookups.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# 👐 Lookups AKA Left Outer Join
1+
# 👐 Lookups, AKA Left Outer Join
22

3-
Using Documents we usually model 1:1, 1:many relationships embedding documents inside other documents, even using arrays for that. For instance an Author can have many aliases, and they live inside an array in the `authors` collection.
3+
Using documents, we usually model 1:1 and 1:many relationships by embedding documents inside other documents, and even using arrays. For instance, an author can have many aliases, and they live inside an array in the `authors` collection.
44

5-
But other times we need to use references to those documents instead of embedding them. For instance an author has an array of the books she has written, but instead of moving the book documents inside an array inside author (which will be tricky for books with multiple authors) we embed the books `_id` instead.
5+
But other times, we need to use references to those documents instead of embedding them. For instance, an author has an array of the books they have written, but instead of moving the book documents inside an array inside author (which will be tricky for books with multiple authors), we embed the books `_id` instead.
66

7-
So how can we get the authors and all the books she has written, embedded in the array? Using `$lookup`, that will do a Left Outer Join and return author docs containing book docs inside.
7+
So how can we get the author and all the books they have written embedded in the array? By using `$lookup`! That will do a left outer join and return author docs containing book docs inside.
88

99
👐 Run this aggregation and look at the results:
1010

@@ -37,7 +37,7 @@ The syntax for this version of `$lookup` is:
3737

3838
## Lookups from a previous stage
3939

40-
We can do a $lookup on the result of another pipeline, not only joining with a collection. For instance, we want to remove some noise from the books before joining, so we use `$project` to exclude a couple arrays.
40+
We can do a $lookup on the result of another pipeline, not only joining with a collection. For instance, we want to remove some noise from the books before joining, so we use `$project` to exclude a couple of arrays.
4141

4242
```js
4343
db.authors.aggregate([
@@ -54,7 +54,7 @@ db.authors.aggregate([
5454
])
5555
```
5656

57-
The nice part is that we can extract that pipeline and test it / tweak it.
57+
The nice part is that we can extract that pipeline and test it/tweak it.
5858

5959
```js
6060
let justShowTitleSynopsis = [

0 commit comments

Comments
 (0)