File tree Expand file tree Collapse file tree 4 files changed +46
-0
lines changed
static/img/30-simple-queries Expand file tree Collapse file tree 4 files changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ import Tabs from ' @theme/Tabs' ;
2
+ import TabItem from ' @theme/TabItem' ;
3
+
1
4
# Using the library database
2
5
3
6
## Select the library database
4
7
5
8
💻 We'll use the ` library ` database. To do that, in a MongoDB shell type in:
6
9
10
+ <Tabs groupId = " aggregations" >
11
+ <TabItem value = " mongosh" label = " mongosh" >
12
+
7
13
``` js
8
14
use library
9
15
```
@@ -14,6 +20,22 @@ You can show all collections with
14
20
show collections
15
21
```
16
22
23
+ </TabItem >
24
+ <TabItem value = " atlas" label = " Atlas UI" >
25
+
26
+ Select the correct DB in the Atlas UI
27
+
28
+
29
+ <Screenshot src = " /img/30-simple-queries/select-db.png" url = " http://cloud.mongodb.com/yourcluster" alt = " AtlasUI Showing the available DBs" />
30
+
31
+ </TabItem >
32
+ </Tabs >
33
+
34
+
35
+
36
+ ---
37
+
38
+
17
39
🦸♂️ 💻 How would you switch to a database called ` orders ` ?
18
40
19
41
:::info
Original file line number Diff line number Diff line change
1
+ import Tabs from ' @theme/Tabs' ;
2
+ import TabItem from ' @theme/TabItem' ;
3
+
1
4
# Empty aggregation pipeline
2
5
3
6
## An empty aggregation
4
7
5
8
This code returns a [ cursor] ( https://www.mongodb.com/docs/manual/reference/method/js-cursor/ ) with all documents in the ` authors ` collection:
6
9
10
+ <Tabs groupId = " aggregations" >
11
+ <TabItem value = " mongosh" label = " mongosh" >
12
+
7
13
``` js
8
14
db .authors .aggregate ([])
9
15
```
10
16
17
+ </TabItem >
18
+ <TabItem value = " atlas" label = " Atlas UI" >
19
+
20
+ <Screenshot src = " /img/30-simple-queries/atlas-aggregation.png" url = " http://cloud.mongodb.com/yourcluster" alt = " AtlasUI Showing the available DBs" />
21
+
22
+ - Open the Aggregation tab
23
+ - Select Text entry
24
+ - Type in the aggregation pipeline:
25
+
26
+ ``` js
27
+ []
28
+ ```
29
+
30
+ </TabItem >
31
+ </Tabs >
32
+
33
+
34
+
11
35
We can iterate over this cursor and get more documents typing ` it ` .
12
36
13
37
💻 Return all the documents in the ` books ` collection and iterate to get the next page of books.
You can’t perform that action at this time.
0 commit comments