All language subtitles for 006 CRUD_ Creating Documents_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:01,280 --> 00:00:02,656 This video will be the first 2 00:00:02,656 --> 00:00:05,689 of the four CRUD operation videos. 3 00:00:05,689 --> 00:00:09,363 So this first one is about creating new documents. 4 00:00:10,720 --> 00:00:13,310 But before we start creating new documents, 5 00:00:13,310 --> 00:00:16,730 let me actually address a concern that you might be having. 6 00:00:16,730 --> 00:00:18,240 So maybe you're wondering, 7 00:00:18,240 --> 00:00:21,540 why are we actually doing all this stuff in a terminal? 8 00:00:21,540 --> 00:00:24,770 And how does this relate to our Express application 9 00:00:24,770 --> 00:00:26,740 that we built in the last section? 10 00:00:26,740 --> 00:00:29,100 Well, the answer for that is that right now, 11 00:00:29,100 --> 00:00:32,383 I want you to learn the absolute fundamentals of MongoDB, 12 00:00:32,383 --> 00:00:35,240 without the context of any application. 13 00:00:35,240 --> 00:00:38,660 So really, completely outside of Node.js. 14 00:00:38,660 --> 00:00:40,900 Because in theory, we could us MongoDB 15 00:00:40,900 --> 00:00:43,730 with any other language or any other framework. 16 00:00:43,730 --> 00:00:45,900 It doesn't have to be with Node.js, 17 00:00:45,900 --> 00:00:48,020 and so I think it's actually a good idea 18 00:00:48,020 --> 00:00:50,980 to learn MongoDB standing completely on its own, 19 00:00:50,980 --> 00:00:53,640 without the context of any other language. 20 00:00:53,640 --> 00:00:54,473 Okay? 21 00:00:54,473 --> 00:00:56,590 Later on, we will of course connect 22 00:00:56,590 --> 00:00:59,260 a MongoDB database with our application, 23 00:00:59,260 --> 00:01:00,520 so that in the next section, 24 00:01:00,520 --> 00:01:03,070 we can then actually start working with databases 25 00:01:03,070 --> 00:01:05,349 inside of our Express application. 26 00:01:05,349 --> 00:01:06,680 And by then we will use 27 00:01:06,680 --> 00:01:09,610 a MongoDB driver just for Node Express, 28 00:01:09,610 --> 00:01:11,720 so that we can use our JavaScript language 29 00:01:11,720 --> 00:01:14,790 to interact with our MongoDB database. 30 00:01:14,790 --> 00:01:15,623 All right? 31 00:01:15,623 --> 00:01:18,830 But for now, let's just learn MongoDB without any of that. 32 00:01:18,830 --> 00:01:19,780 All right? 33 00:01:19,780 --> 00:01:22,380 So in the last lecture, we created a new database. 34 00:01:22,380 --> 00:01:24,950 A new collection inside, called tours, 35 00:01:24,950 --> 00:01:27,430 and then one new document in there. 36 00:01:27,430 --> 00:01:28,263 Right? 37 00:01:28,263 --> 00:01:29,360 Remember that? 38 00:01:29,360 --> 00:01:31,730 And to do that, we used insert 1. 39 00:01:31,730 --> 00:01:32,830 Remember that? 40 00:01:32,830 --> 00:01:34,460 But now, let's actually create 41 00:01:34,460 --> 00:01:36,980 two documents at the same time. 42 00:01:36,980 --> 00:01:38,720 So that works like this. 43 00:01:38,720 --> 00:01:43,720 db, with just again, the current database, then .tours, 44 00:01:44,020 --> 00:01:45,700 which is the collection where we want 45 00:01:45,700 --> 00:01:49,053 to add our new documents, and then .insertMany. 46 00:01:51,640 --> 00:01:52,473 Okay? 47 00:01:52,473 --> 00:01:56,003 And insertMany is gonna accept an array of multiple objects. 48 00:01:56,900 --> 00:01:59,143 So an array, and then close it. 49 00:02:00,210 --> 00:02:02,500 So an empty object, and that may actually 50 00:02:02,500 --> 00:02:05,459 put the second empty object here also already, 51 00:02:05,459 --> 00:02:08,883 and so all we need to do is to fill up these objects. 52 00:02:10,030 --> 00:02:13,713 So name, this one is called The Sea Explorer. 53 00:02:17,070 --> 00:02:21,140 It has a price of 497, and a rating of 4.8. 54 00:02:27,030 --> 00:02:28,703 And then the next object. 55 00:02:30,560 --> 00:02:35,560 Let's give it a name of The Snow Adventurer. 56 00:02:38,210 --> 00:02:42,070 Which is one of the other nine tours that we have. 57 00:02:42,070 --> 00:02:46,283 Then the price is a bit more expensive, 997. 58 00:02:48,030 --> 00:02:51,020 And the rating is 4.9. 59 00:02:51,020 --> 00:02:53,600 And actually, let's add another field here. 60 00:02:53,600 --> 00:02:55,700 So, remember from the intro lecture 61 00:02:55,700 --> 00:02:59,600 how I said that MongoDB documents are very flexible. 62 00:02:59,600 --> 00:03:03,310 And so they do not all have to have the same structure. 63 00:03:03,310 --> 00:03:04,143 Okay? 64 00:03:04,143 --> 00:03:06,790 So we can have different fields in different documents. 65 00:03:06,790 --> 00:03:09,253 And so let's add the difficulty here. 66 00:03:13,690 --> 00:03:16,100 And set this one to easy. 67 00:03:16,100 --> 00:03:17,040 Okay? 68 00:03:17,040 --> 00:03:19,440 So that's it, let's hit return here. 69 00:03:19,440 --> 00:03:22,390 And so we inserted two new documents, 70 00:03:22,390 --> 00:03:25,280 and here we see the IDs that they got. 71 00:03:25,280 --> 00:03:26,940 So these two auto-generated 72 00:03:26,940 --> 00:03:29,325 unique identifiers for each of them. 73 00:03:29,325 --> 00:03:30,390 Okay? 74 00:03:30,390 --> 00:03:35,370 Now just to make sure, remember make db.tours.find, 75 00:03:38,350 --> 00:03:41,490 and here indeed, we now have our three tours. 76 00:03:41,490 --> 00:03:43,780 So that's the one we created in the last lecture, 77 00:03:43,780 --> 00:03:46,190 and then the two that we just created. 78 00:03:46,190 --> 00:03:47,290 Okay? 79 00:03:47,290 --> 00:03:49,320 So that's actually it for this lecture, 80 00:03:49,320 --> 00:03:52,670 just to recap, we used the insertMany function 81 00:03:52,670 --> 00:03:56,050 to pass in an array of two objects, 82 00:03:56,050 --> 00:03:59,267 or two documents that we wanted to create. 83 00:03:59,267 --> 00:04:00,400 Okay? 84 00:04:00,400 --> 00:04:03,150 So that's all I had for this one. 85 00:04:03,150 --> 00:04:05,500 In the next one, we will then learn how to do 86 00:04:05,500 --> 00:04:09,220 some advanced queries to search for data in our database. 87 00:04:09,220 --> 00:04:12,613 So that's an exciting one, so let's move on immediately. 6566

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