1
00:00:02,200 --> 00:00:05,730
Now, before we now get started with diving

2
00:00:05,730 --> 00:00:09,540
into the MongoDB syntax, and how we can write queries,

3
00:00:09,540 --> 00:00:12,950
and run queries against our MongoDB database,

4
00:00:12,950 --> 00:00:17,150
there is one additional tool you might wanna install.

5
00:00:17,150 --> 00:00:20,510
And that's the MongoDB Shell.

6
00:00:20,510 --> 00:00:23,990
Now, actually, we already did install a shell

7
00:00:23,990 --> 00:00:27,400
together with the MongoDB server in the last lecture.

8
00:00:27,400 --> 00:00:30,580
And we already did start the shell there.

9
00:00:30,580 --> 00:00:35,580
That was that tool which we executed in the command line

10
00:00:35,700 --> 00:00:38,640
or by double-clicking on it on Windows

11
00:00:38,640 --> 00:00:42,350
to then connect to our running MongoDB server.

12
00:00:42,350 --> 00:00:46,350
So that tool, which we'll use for inputting commands

13
00:00:46,350 --> 00:00:49,350
for sending commands to the server.

14
00:00:49,350 --> 00:00:52,000
But depending on the point of time

15
00:00:52,000 --> 00:00:54,130
you are watching this course,

16
00:00:54,130 --> 00:00:57,330
that shell might be the old shell,

17
00:00:57,330 --> 00:00:59,220
which is perfectly fine to use.

18
00:00:59,220 --> 00:01:00,810
There's nothing wrong with it,

19
00:01:00,810 --> 00:01:03,180
but there is a newer shell available.

20
00:01:03,180 --> 00:01:05,940
And you either already have that

21
00:01:05,940 --> 00:01:08,760
or you need to install it separately.

22
00:01:08,760 --> 00:01:09,593
And you can tell

23
00:01:09,593 --> 00:01:11,920
whether you already have it by the look of it.

24
00:01:11,920 --> 00:01:13,170
And whether installing

25
00:01:13,170 --> 00:01:15,783
it separately changes anything for you.

26
00:01:17,130 --> 00:01:19,650
Now, to get that newer shell,

27
00:01:19,650 --> 00:01:22,000
you can search for MongoDB Shell.

28
00:01:22,000 --> 00:01:25,620
And you might find this link to the Legacy Mongo Shell,

29
00:01:25,620 --> 00:01:26,890
which is two older one,

30
00:01:26,890 --> 00:01:29,330
which you already might have installed automatically

31
00:01:29,330 --> 00:01:31,650
together with the MongoDB server.

32
00:01:31,650 --> 00:01:33,330
And you should all have find

33
00:01:33,330 --> 00:01:36,303
this MongoDB Shell download link.

34
00:01:37,370 --> 00:01:40,200
Alternatively, you can get there on mongodb.com

35
00:01:40,200 --> 00:01:43,030
by clicking on Software, Developer Tools.

36
00:01:43,030 --> 00:01:45,853
And then there, choosing the MongoDB Shell.

37
00:01:47,090 --> 00:01:49,300
And then here, you can click on Download Now

38
00:01:49,300 --> 00:01:51,173
to be taken to that same page.

39
00:01:52,390 --> 00:01:55,210
Now here again, you can choose your operating system.

40
00:01:55,210 --> 00:01:56,910
There are different versions available

41
00:01:56,910 --> 00:01:58,920
for all the operating systems.

42
00:01:58,920 --> 00:02:01,723
And you can then simply download that shell.

43
00:02:02,800 --> 00:02:05,980
On Windows, instead, you would have this installer,

44
00:02:05,980 --> 00:02:07,163
which you download.

45
00:02:10,190 --> 00:02:11,590
And once downloaded,

46
00:02:11,590 --> 00:02:16,013
we simply execute it and then walk through that installer.

47
00:02:16,920 --> 00:02:19,770
We can keep that default path,

48
00:02:19,770 --> 00:02:23,203
which it chooses here and then choose Next.

49
00:02:24,060 --> 00:02:26,730
And start this installation.

50
00:02:26,730 --> 00:02:29,300
So it's really straightforward here.

51
00:02:29,300 --> 00:02:32,670
And then we're done on Windows.

52
00:02:32,670 --> 00:02:34,010
Now, back on macOS.

53
00:02:34,010 --> 00:02:36,740
Here, we have to extract that ZIP file.

54
00:02:36,740 --> 00:02:38,100
And we'll get a new folder,

55
00:02:38,100 --> 00:02:40,143
which contains such a bin folder.

56
00:02:42,400 --> 00:02:46,410
And in there, you have two different files.

57
00:02:46,410 --> 00:02:51,410
And for us, the Mongo Shell file is the most important one.

58
00:02:51,480 --> 00:02:52,540
But you can grab,

59
00:02:52,540 --> 00:02:55,633
and you should grab both files and copy them.

60
00:02:56,750 --> 00:02:59,950
And then move them to the directory

61
00:02:59,950 --> 00:03:03,473
where you installed your other MongoDB tools.

62
00:03:04,930 --> 00:03:09,150
On macOS, that should be your USR folder.

63
00:03:09,150 --> 00:03:12,610
And you need to make sure that you can view hidden folders

64
00:03:12,610 --> 00:03:14,190
and files to view that.

65
00:03:14,190 --> 00:03:17,870
You can do that by hitting Command + Shift and dot.

66
00:03:17,870 --> 00:03:21,610
And then in that USR folder, go to local bin.

67
00:03:21,610 --> 00:03:24,430
And that's where we copied the other Mongo commands

68
00:03:24,430 --> 00:03:28,020
before when we installed MongoDB on macOS.

69
00:03:28,020 --> 00:03:32,260
So now, move these two new executables into that folder.

70
00:03:32,260 --> 00:03:35,550
You might need to enter your password to do that.

71
00:03:40,340 --> 00:03:44,090
On Windows, you can now open your Windows menu,

72
00:03:44,090 --> 00:03:45,150
the start menu.

73
00:03:45,150 --> 00:03:47,090
And there, search for MongoSH.

74
00:03:48,040 --> 00:03:52,370
So Mongosh and execute this command, this tool,

75
00:03:52,370 --> 00:03:54,700
which is the Mongo Shell we just installed.

76
00:03:54,700 --> 00:03:56,800
And this will open up the Mongo Shell

77
00:03:56,800 --> 00:04:00,460
and connect to your running MongoDB server.

78
00:04:00,460 --> 00:04:01,520
So of course, therefore,

79
00:04:01,520 --> 00:04:04,570
you need to have such a running MongoDB server,

80
00:04:04,570 --> 00:04:06,950
this running service here in case of Windows

81
00:04:06,950 --> 00:04:09,183
so that this connection succeeds.

82
00:04:10,180 --> 00:04:14,050
On macOS, we would typically open our terminal.

83
00:04:14,050 --> 00:04:17,880
And simply execute Mongosh as a command there.

84
00:04:17,880 --> 00:04:20,930
And then connect to our running MongoDB server.

85
00:04:20,930 --> 00:04:21,839
And for this, of course,

86
00:04:21,839 --> 00:04:25,010
we need to have our server up and running there as well.

87
00:04:25,010 --> 00:04:27,210
That is a must have.

88
00:04:27,210 --> 00:04:29,150
Now, you can ignore any warnings

89
00:04:29,150 --> 00:04:31,020
or any messages you might see here.

90
00:04:31,020 --> 00:04:33,010
We don't need to worry about them right now.

91
00:04:33,010 --> 00:04:35,790
Instead, we can now use this shell to interact

92
00:04:35,790 --> 00:04:36,853
with the database.

93
00:04:37,710 --> 00:04:38,780
And then this shell

94
00:04:38,780 --> 00:04:41,790
is connected on both Windows and macOS.

95
00:04:41,790 --> 00:04:44,810
And this shell in the end supports the same commands

96
00:04:44,810 --> 00:04:47,150
you could also use in the old shell.

97
00:04:47,150 --> 00:04:49,920
So you could use either of the two shells,

98
00:04:49,920 --> 00:04:52,530
but it is more future-proof to follow along

99
00:04:52,530 --> 00:04:53,890
with this newer shell.

100
00:04:53,890 --> 00:04:58,050
And maybe you already had this shell as a default shell

101
00:04:58,050 --> 00:05:01,210
right from the start when you first installed MongoDB

102
00:05:01,210 --> 00:05:03,720
in the last lectures anyways.

103
00:05:03,720 --> 00:05:06,560
Now, just as before, you can run show DBs

104
00:05:06,560 --> 00:05:09,170
in here to see a list of your databases.

105
00:05:09,170 --> 00:05:12,680
And there, we got some dummy starting databases,

106
00:05:12,680 --> 00:05:15,563
but I'm now going to continue with this new shell here.

