File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -38,14 +38,26 @@ IF pages == 100 AND totalInventory == 2 {
38
38
}
39
39
```
40
40
41
- 💻 Return all the ` books ` from 2011 that have exactly 100 pages.
41
+ 💻 Return all the ` books ` from 2015 that have exactly 100 pages.
42
42
43
43
<details >
44
44
<summary >Answer</summary >
45
45
<div >
46
46
47
47
``` 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 ()
49
61
```
50
62
</div >
51
63
</details >
@@ -58,14 +70,14 @@ We can do an implicit AND just passing a document with all the conditions (inste
58
70
db .books .aggregate ([{$match: {pages: 100 , totalInventory: 2 }}])
59
71
```
60
72
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
62
74
63
75
<details >
64
76
<summary >Answer</summary >
65
77
<div >
66
78
67
79
``` js
68
- db .books .aggregate ([{$match: {pages: 100 , year: 2011 }}])
80
+ db .books .aggregate ([{$match: {pages: 100 , year: 2015 }}])
69
81
```
70
82
</div >
71
83
</details >
You can’t perform that action at this time.
0 commit comments