All language subtitles for 020 Importing Review and User Data_Downloadly.ir_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
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
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

So before moving on to implementing

some more API features, let's now very quickly import

the rest of our development data.

So data on users, and on reviews.

So, in our dev data folder,

we already imported all the tours, right?

But, we also have a users, and we also have reviews, okay?

So, I have created a bunch of users for us to work with

throughout the rest of the course,

so all of these, I think it's about 20 users,

and then also a bunch of reviews, okay.

And so, all we need to do now is to basically update

or import dev data script, so basically duplicate this here.

So, tours will become users,

and here tours will become reviews.

Then, we also need to import the other two models,

so review, and here as well.

Now all right, and now then here,

also, basically duplicate this, user,

and review.

All right.

And that should probably do with the job, all right.

So, let's go to our other terminal window here, clear this,

and actually the last operation that we did was this one.

So, we need to start by deleting everything we have.

Oh, and I see now that we actually only deleted the tours.

All right, and so we also want to get rid

of all the current users that we have right now

because they are really all just test users, all right.

And the same of course goes for reviews.

So, a gift is a save,

and now deleting all of them,

just taking a quick look into Compass,

and so you see that, indeed, all the users are gone,

and so the same should be true for the other collections.

All right, and so now let's go ahead

and import all of the data.

That's gonna take a little bit of time,

and now, we get this validation error here.

Okay, so please confirm your password.

And so, that's basically because we're creating a new user

without specifying the password confirm property.

So, the solution to that is to actually explicitly turn off

the validation in this case, okay?

And, I'm not sure if we have done that before,

but it's actually very easy.

Okay, so all we need to do is to pass in

an additional object with some options,

and actually in this case, just one.

And, the option that we want is validateBeforeSave,

and set it to false.

Okay, and so with this, all of the validation that we do

in the model will basically just be skipped, okay?

Also, another thing that we need to do

in the model is to turn off the password encryption

because the users that we provide already have

an encrypted password here, all right.

And so, here in our user model,

we now basically just need to comment out

all of these (mumbles).

Okay, and so now,

the password encryption step is also gonna be skipped.

So, we'll give this a save,

and now lets, actually, first of all, delete the data again,

just so we don't create any duplicates,

and now let's try it again with import, and yeah.

This time we didn't get any error,

and so let's take a look at that in Compass,

so we have all the users,

we should have all natours as well.

And, indeed, here they are, and also a couple of reviews.

And, you'll see 60 reviews actually I created, okay?

And let's just confirm

that the passwords for users were not encrypted,

so I'm just copying this one here, just this entire line.

Oh, that doesn't work.

So, let's just copy this string here

and then compare with the one we have in our adjacent file.

So, just the first one here,

and yeah, indeed, you see that it looks

exactly the same as this one, right?

And so, just as we wanted,

the passwords were not encrypted this time.

Okay, so let's close all of this,

make sure to remove the comments that we now put here,

so that in the future of course,

new users will then get their passwords encrypted properly.

So, save this, and now I want to quickly take a look

at the data here.

So, in Postman, and the first thing

that I want to do is to actually log in as an administrator.

All right, so let's take a look at the email address,

and so you see it's actually admin@natours.io, okay?

And, of course the password, we cannot retrieve from here,

but I know, of course, what password I specified,

and so we can use that.

And so, the password

for all of the users here is always test1234, okay?

So, that worked.

So, again for all of the 20 users that I created,

the password is always the same, always test1234.

Great, now let's quickly get all tours here as well.

And so, let's actually just remove this filter here.

Okay, and so we get all our natours,

and now you see that all of them now will have guides.

Okay, so this is a lead guide and a normal guide,

and also all of them will have a bunch of reviews.

Somewhere, so that should be here,

but I believe we only populated the reviews

when we get just one tour,

so that's try that here with the (mumbles).

So, I copied the ID so that I can now put it in here.

Let's send that,

so the guides' locations,

and indeed, now we get all of the reviews.

And of course, just like we configured before

here then the user also gets populated,

and the tour does not.

So, everything still works the same,

but now we have a bunch of more real world data

that we can now start working with

throughout the rest of the course.

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