All language subtitles for 006 Setting Up A MongoDB Database_Downloadly.ir_en

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian Download
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:02,120 --> 00:00:05,590 So now that we added our API routes 2 00:00:05,590 --> 00:00:07,680 or the newsletter in for the comments 3 00:00:07,680 --> 00:00:09,120 and that we wired up 4 00:00:09,120 --> 00:00:11,890 those front-end components for the newsletter 5 00:00:11,890 --> 00:00:13,870 and for the comments. 6 00:00:13,870 --> 00:00:16,210 Now that all of that was done. 7 00:00:16,210 --> 00:00:20,130 It's time to work on the logic inside of the API routes 8 00:00:20,130 --> 00:00:24,620 because at the moment we don't do anything in there. 9 00:00:24,620 --> 00:00:26,340 In the newsletter API route we're 10 00:00:26,340 --> 00:00:28,580 just logging the entered email 11 00:00:28,580 --> 00:00:30,840 and in the comments API route 12 00:00:30,840 --> 00:00:32,616 for the post case, 13 00:00:32,616 --> 00:00:34,520 we also in the end, 14 00:00:34,520 --> 00:00:37,430 just log our comment here. 15 00:00:37,430 --> 00:00:41,060 And that of course is not too helpful. 16 00:00:41,060 --> 00:00:42,740 That's not the goal. 17 00:00:42,740 --> 00:00:46,310 Instead, we wanna store that data more permanently 18 00:00:46,310 --> 00:00:49,303 and we could of course use a file for that. 19 00:00:49,303 --> 00:00:52,410 We could re-add a data folder 20 00:00:52,410 --> 00:00:55,050 in our project with some JSON 21 00:00:55,050 --> 00:00:59,790 or a text file and write that data to that file. 22 00:00:59,790 --> 00:01:03,100 But I would argue it's more realistic to use a database 23 00:01:03,100 --> 00:01:04,959 and therefore that's what we'll do. 24 00:01:04,959 --> 00:01:06,930 I'll use a real database here. 25 00:01:06,930 --> 00:01:08,790 I'll use MongoDB. 26 00:01:08,790 --> 00:01:11,920 MongoDB of course is just one option. 27 00:01:11,920 --> 00:01:13,679 It's not a must use option, 28 00:01:13,679 --> 00:01:17,085 but I will use it because using MongoDB 29 00:01:17,085 --> 00:01:21,165 with Node.js is particularly easy 30 00:01:21,165 --> 00:01:23,900 and it's also a production ready, 31 00:01:23,900 --> 00:01:27,520 scalable database which is a great choice 32 00:01:27,520 --> 00:01:29,960 for pretty much all projects. 33 00:01:29,960 --> 00:01:32,600 For a lot of projects, Let's put it like this. 34 00:01:32,600 --> 00:01:34,990 And that's why we'll use MongoDB. 35 00:01:34,990 --> 00:01:38,170 Even better than that, we can get started for free. 36 00:01:38,170 --> 00:01:41,570 If you visit MongoDB.com and you go to pricing, 37 00:01:41,570 --> 00:01:43,980 you'll see that they have various offerings 38 00:01:43,980 --> 00:01:46,310 and we will use the cloud service here, 39 00:01:46,310 --> 00:01:47,883 MongoDB Atlas. 40 00:01:49,210 --> 00:01:53,200 That is their fully managed cloud database service, 41 00:01:53,200 --> 00:01:55,780 which we can use without setting up anything 42 00:01:55,780 --> 00:01:57,940 on our local system, which is great. 43 00:01:57,940 --> 00:02:00,650 And we can get started for free here, 44 00:02:00,650 --> 00:02:01,680 which is awesome. 45 00:02:01,680 --> 00:02:04,023 So we can click on start free here actually. 46 00:02:06,060 --> 00:02:07,490 Or in the top right corner, 47 00:02:07,490 --> 00:02:09,410 click on Try Free, 48 00:02:09,410 --> 00:02:10,970 click on Cloud 49 00:02:10,970 --> 00:02:14,680 and then get started for free here by signing up. 50 00:02:14,680 --> 00:02:18,325 just fill out these basic details and sign up. 51 00:02:18,325 --> 00:02:20,180 I already do have an account 52 00:02:20,180 --> 00:02:22,520 so I will log in with that. 53 00:02:22,520 --> 00:02:25,230 And once you did sign up and log in, 54 00:02:25,230 --> 00:02:27,570 you should be greeted with some screen 55 00:02:27,570 --> 00:02:29,870 that looks something like this. 56 00:02:29,870 --> 00:02:32,400 You should be able to build a cluster 57 00:02:33,350 --> 00:02:36,180 and then there use a shared cluster. 58 00:02:36,180 --> 00:02:37,860 So, create a cluster here 59 00:02:37,860 --> 00:02:40,940 where you can get started for free. 60 00:02:40,940 --> 00:02:44,570 No, a cluster is basically a server. 61 00:02:44,570 --> 00:02:45,460 You could say, 62 00:02:45,460 --> 00:02:48,220 which will then later host your databases, 63 00:02:48,220 --> 00:02:49,720 you could say. 64 00:02:49,720 --> 00:02:52,010 Now here we need to choose a cloud provider 65 00:02:52,010 --> 00:02:53,760 which will be used under the hood. 66 00:02:53,760 --> 00:02:55,516 And we can stick to AWS here 67 00:02:55,516 --> 00:02:58,370 and basically keep the defaults 68 00:02:59,920 --> 00:03:01,937 for a cluster tier let's stick 69 00:03:01,937 --> 00:03:06,563 to the M0 Sandbox since that's available for free. 70 00:03:07,730 --> 00:03:09,410 And for the additional settings, 71 00:03:09,410 --> 00:03:11,480 we also can stick to the defaults 72 00:03:11,480 --> 00:03:13,940 and we can also keep that default cluster name 73 00:03:13,940 --> 00:03:16,460 and create that cluster. 74 00:03:16,460 --> 00:03:19,110 Now, this will set up this database cluster 75 00:03:19,110 --> 00:03:20,910 which will then enable us to connect 76 00:03:20,910 --> 00:03:23,120 to this cluster and store data 77 00:03:23,120 --> 00:03:25,090 in the databases there. 78 00:03:25,090 --> 00:03:28,150 And using it will be super simple. 79 00:03:28,150 --> 00:03:29,850 Now, whilst this is getting set up, 80 00:03:29,850 --> 00:03:32,500 we can go back to our project already 81 00:03:32,500 --> 00:03:34,400 and quit the dev server 82 00:03:34,400 --> 00:03:36,280 and install an extra package 83 00:03:36,280 --> 00:03:37,673 with npm install. 84 00:03:38,593 --> 00:03:40,930 Because in order to communicate 85 00:03:40,930 --> 00:03:45,305 with MongoDB and to send queries to MongoDB, 86 00:03:45,305 --> 00:03:49,290 we need to install a new third party package. 87 00:03:49,290 --> 00:03:51,770 If you search for Node.js MongoDB, 88 00:03:51,770 --> 00:03:53,455 you also find it on npm. 89 00:03:53,455 --> 00:03:55,580 It's this MongoDB package 90 00:03:55,580 --> 00:03:59,230 which is the official driver for MongoDB. 91 00:03:59,230 --> 00:04:01,750 So that makes connecting and talking 92 00:04:01,750 --> 00:04:05,280 to the Mongo DB database super easy then. 93 00:04:05,280 --> 00:04:08,240 So we should install MongoDB, 94 00:04:08,240 --> 00:04:10,950 this MongoDB package here like this 95 00:04:10,950 --> 00:04:13,130 with npm installed MongoDB. 96 00:04:13,130 --> 00:04:15,500 And this will install this third party package 97 00:04:15,500 --> 00:04:17,980 which we'll then use in our server side code 98 00:04:17,980 --> 00:04:20,899 to talk to MongoDB to our cluster 99 00:04:20,899 --> 00:04:22,700 and to store data and 100 00:04:22,700 --> 00:04:24,910 to fetch data as well Of course. 101 00:04:24,910 --> 00:04:27,600 And the important thing here really is 102 00:04:27,600 --> 00:04:30,480 that we'll use it in our server side code. 103 00:04:30,480 --> 00:04:32,930 So in these API routes, 104 00:04:32,930 --> 00:04:36,060 we will not use this Mongo DB package 105 00:04:36,060 --> 00:04:38,356 in any client side code. 106 00:04:38,356 --> 00:04:41,410 A, because it's not optimized for that. 107 00:04:41,410 --> 00:04:43,620 It might not even work there because there 108 00:04:43,620 --> 00:04:48,350 is a high chance that it uses Node.js APIs internally 109 00:04:48,350 --> 00:04:51,750 and b, even if it does work in the browser, 110 00:04:51,750 --> 00:04:54,230 it would be a security issue. 111 00:04:54,230 --> 00:04:56,439 Because for talking to the database, 112 00:04:56,439 --> 00:04:59,410 we will need to plug our credentials 113 00:04:59,410 --> 00:05:01,610 into the code and we don't wanna do 114 00:05:01,610 --> 00:05:04,004 that in any code our users can see 115 00:05:04,004 --> 00:05:07,102 because they could then abuse those credentials 116 00:05:07,102 --> 00:05:09,819 to hack into our database. 117 00:05:09,819 --> 00:05:14,750 That's why we want to run such database code only 118 00:05:14,750 --> 00:05:16,100 on the server side. 119 00:05:16,100 --> 00:05:18,763 So, only in our API routes. 120 00:05:20,010 --> 00:05:23,150 Now connecting to the cluster is done here now. 121 00:05:23,150 --> 00:05:25,360 And when we clicked on Connect, 122 00:05:25,360 --> 00:05:28,360 we can choose connect your application. 123 00:05:28,360 --> 00:05:32,050 And we see code which we can use to connect 124 00:05:32,050 --> 00:05:37,050 to our MongoDB cluster with the Node.js driver here. 125 00:05:37,490 --> 00:05:38,640 And that's what we're going 126 00:05:38,640 --> 00:05:40,283 to do in the next lectures. 9260

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.