Skip to content

Commit 5903b92

Browse files
committed
Fixed sample for new data
1 parent bd80c06 commit 5903b92

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,26 @@ IF pages == 100 AND totalInventory == 2 {
3838
}
3939
```
4040

41-
💻 Return all the `books` from 2011 that have exactly 100 pages.
41+
💻 Return all the `books` from 2015 that have exactly 100 pages.
4242

4343
<details>
4444
<summary>Answer</summary>
4545
<div>
4646

4747
```js
48-
db.books.aggregate([{$match: {$and: [{pages: 100}, {year: 2011}]}}])
48+
db.books.aggregate([{$match: {$and: [{pages: 100}, {year: 2015}]}}])
49+
```
50+
</div>
51+
</details>
52+
53+
💻 How many are they? (_hint: use `itcount()`_).
54+
55+
<details>
56+
<summary>Answer</summary>
57+
<div>
58+
59+
```js
60+
db.books.aggregate([{$match: {$and: [{pages: 100}, {year: 2015}]}}]).itcount()
4961
```
5062
</div>
5163
</details>
@@ -58,14 +70,14 @@ We can do an implicit AND just passing a document with all the conditions (inste
5870
db.books.aggregate([{$match: {pages: 100, totalInventory: 2}}])
5971
```
6072

61-
💻 Return all the `books` from 2011 that have exactly 100 pages, using the simple $and notation
73+
💻 Return all the `books` from 2015 that have exactly 100 pages, using the simple $and notation
6274

6375
<details>
6476
<summary>Answer</summary>
6577
<div>
6678

6779
```js
68-
db.books.aggregate([{$match: {pages: 100, year: 2011}}])
80+
db.books.aggregate([{$match: {pages: 100, year: 2015}}])
6981
```
7082
</div>
7183
</details>

0 commit comments

Comments
 (0)