Installation

6 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$49.99
List Price:  $69.99
You save:  $20
€46.41
List Price:  €64.99
You save:  €18.57
£39.85
List Price:  £55.80
You save:  £15.94
CA$68.38
List Price:  CA$95.74
You save:  CA$27.36
A$75.69
List Price:  A$105.97
You save:  A$30.28
S$67.65
List Price:  S$94.71
You save:  S$27.06
HK$390.96
List Price:  HK$547.38
You save:  HK$156.41
CHF 45.35
List Price:  CHF 63.50
You save:  CHF 18.14
NOK kr542.95
List Price:  NOK kr760.18
You save:  NOK kr217.22
DKK kr346.22
List Price:  DKK kr484.74
You save:  DKK kr138.51
NZ$83.20
List Price:  NZ$116.49
You save:  NZ$33.28
د.إ183.60
List Price:  د.إ257.06
You save:  د.إ73.45
৳5,484.79
List Price:  ৳7,679.15
You save:  ৳2,194.35
₹4,174.22
List Price:  ₹5,844.24
You save:  ₹1,670.02
RM236.85
List Price:  RM331.61
You save:  RM94.76
₦61,737.65
List Price:  ₦86,437.65
You save:  ₦24,700
₨13,903.63
List Price:  ₨19,466.20
You save:  ₨5,562.56
฿1,842.69
List Price:  ฿2,579.91
You save:  ฿737.22
₺1,612.90
List Price:  ₺2,258.19
You save:  ₺645.29
B$253.75
List Price:  B$355.28
You save:  B$101.52
R922.13
List Price:  R1,291.06
You save:  R368.92
Лв90.85
List Price:  Лв127.20
You save:  Лв36.34
₩67,969.88
List Price:  ₩95,163.27
You save:  ₩27,193.39
₪185.94
List Price:  ₪260.34
You save:  ₪74.39
₱2,861.35
List Price:  ₱4,006.12
You save:  ₱1,144.77
¥7,722.34
List Price:  ¥10,811.89
You save:  ¥3,089.55
MX$843.21
List Price:  MX$1,180.56
You save:  MX$337.35
QR182.28
List Price:  QR255.22
You save:  QR72.93
P678.57
List Price:  P950.05
You save:  P271.48
KSh6,648.67
List Price:  KSh9,308.67
You save:  KSh2,660
E£2,385.52
List Price:  E£3,339.92
You save:  E£954.40
ብር2,869.28
List Price:  ብር4,017.22
You save:  ብር1,147.94
Kz41,825.96
List Price:  Kz58,559.69
You save:  Kz16,733.73
CLP$46,485.20
List Price:  CLP$65,083
You save:  CLP$18,597.80
CN¥354.33
List Price:  CN¥496.09
You save:  CN¥141.76
RD$2,899.21
List Price:  RD$4,059.13
You save:  RD$1,159.91
DA6,716.85
List Price:  DA9,404.13
You save:  DA2,687.28
FJ$112.23
List Price:  FJ$157.14
You save:  FJ$44.90
Q388.45
List Price:  Q543.86
You save:  Q155.41
GY$10,455.72
List Price:  GY$14,638.84
You save:  GY$4,183.12
ISK kr6,977.10
List Price:  ISK kr9,768.50
You save:  ISK kr2,791.40
DH500.96
List Price:  DH701.39
You save:  DH200.42
L885.56
List Price:  L1,239.86
You save:  L354.29
ден2,861.59
List Price:  ден4,006.46
You save:  ден1,144.86
MOP$402.29
List Price:  MOP$563.24
You save:  MOP$160.94
N$920.44
List Price:  N$1,288.69
You save:  N$368.25
C$1,839.55
List Price:  C$2,575.52
You save:  C$735.96
रु6,679.37
List Price:  रु9,351.66
You save:  रु2,672.28
S/186.27
List Price:  S/260.79
You save:  S/74.52
K193.32
List Price:  K270.67
You save:  K77.34
SAR187.48
List Price:  SAR262.50
You save:  SAR75.01
ZK1,358.11
List Price:  ZK1,901.47
You save:  ZK543.35
L231.01
List Price:  L323.43
You save:  L92.42
Kč1,161.35
List Price:  Kč1,625.98
You save:  Kč464.63
Ft18,056.25
List Price:  Ft25,280.20
You save:  Ft7,223.94
SEK kr542.25
List Price:  SEK kr759.20
You save:  SEK kr216.94
ARS$44,003.90
List Price:  ARS$61,608.98
You save:  ARS$17,605.08
Bs345.36
List Price:  Bs483.53
You save:  Bs138.17
COP$195,270.45
List Price:  COP$273,394.26
You save:  COP$78,123.80
₡25,568.20
List Price:  ₡35,797.53
You save:  ₡10,229.32
L1,234.61
List Price:  L1,728.55
You save:  L493.94
₲373,712.67
List Price:  ₲523,227.64
You save:  ₲149,514.97
$U1,909.55
List Price:  $U2,673.53
You save:  $U763.97
zł200.30
List Price:  zł280.44
You save:  zł80.13
Already have an account? Log In

Transcript

In order to install MongoDB on your Windows machine, first download the appropriate installer. So let's go to mongodb.com. And in the home page on the top right corner somewhere you will see here that there is a download link. Let's click that. And that gives us few options and I would like to go with the community server. And in the community server since we are using Windows machine here, we have a couple of options.

And the one that is shown by default is the one that we want to install. Let's click the Download button. The download will take few seconds. So now that the download is done, so let's open the folder and here is the installer. So let's go and double click that and complete the wizard by choosing the wants to appropriate options. By default, it has been installed in C drive Program Files MongoDB server 3.4.

So there's our location. And in the bin directory, we will see some applications or executables. The one executable that we are interested right now is the Mongo D, which is a server process. There is also a client application. So one thing is you can just double click this Mongo D, but it fails to start up because it looks for a folder called Data slash DB in your C drive. I don't have this folder, and when we run this, we can supply an alternate folder.

With MongoDB, we'll use that as a temporary folder. So in order to test this, let's open a command prompt. And then type the command Mongo D, with probably dash dash version. And it gives me an error saying that Mongo D is not recognized as an internal or external command to make this Mongo D command available. On all command prompts, were to add this folder location to our path environment variable. So I'm going to copy that.

And then right click this PC properties, advanced system settings, environment variables, and I can add either here, or I can append to an existing path here. So let's go and add a new environment variable called path and paste that location that we copied. Once you say, OK, OK, and Ok, let's close all the windows, and then I'll open a new command prompt type the same command MongoDB dash dash version. And we get this washer now, which means you have successfully installed the MongoDB software. The next step is to create a data folder for MongoDB. So I'm going to open C drive and create a new folder.

Now the name can be anything, I'll give MongoDB dash data. And then I can use this path. When I run the server to run the server issue this command from any command prompt now, which is Mongo, D, dash dash DB path, C colon MongoDB dash data. You can also optionally change the port numbers or the location of the server, etc. But I would like to leave it to the default. When I press enter, it starts the server.

And you can see that there is a message that comes up waiting for connections on port 27017. Now that happens to be the default port number. If you got this screen that means your MongoDB installation is successful and it has been started. Now let's minimize this and open a new command prompt. This time, I want to connect to the server using a Mongo client and then check if I can issue some commands. For example, I will type Mongo and then press Enter.

And you will see that it connects to a server. So it says connecting to MongoDB slash slash 127 zero dot zero dot one, which means localhost. And then the port is 27017, which is where our MongoDB is running. Through this command prompt, I can issue some MongoDB specific commands, for example, show DBS will give you the list of databases that have been created and visible. Now I can create a new DB by just typing use, for example, test two dB. Now it says switch to the DB test dB.

However, if I against a show DBS, it will not be listed because it doesn't contain anything. So it gets lazily created, which means only when you add some data into your database, the database comes to existence. So we can also issue a command called a DB to check what is the name of the DB, and it says that the current database is test two dB. Another command that can be used at this time is show collections. Now since this DB is empty, there are no collections at all. However, we can add a new collection and reissue all these commands to see a different result.

So let's create a new collection by adding a new document to that. And it's very simple, just have to type DB dot and imaginary collection name for example, I can say contacts dot insert, and then I can pass on a JSON document. So with a name value pairs for example, I can say name, we note, email, we know we know.co now if I complete this, you will see that It says right result, number of records inserted is one. And if I now issue the commands show DBS, you will see that there is a new database called test dB. If I also say show collections, I can see my collection which is a contacts. And now to see the data which is stored in the context, I have to issue a command DB dot context or find one, you can observe that there is another field inserted called underscore ID, which has to be there for every document of any collection.

Now, the value for this can be user defined also but if you don't mention, an object of a class called object ID will be created. And we will talk about this object ID in the future lessons.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.