NestJS with MongoDB & Mongoose - FULL BEGINNER TUTORIAL
Вставка
- Опубліковано 5 сер 2024
- Code: github.com/stuyy/nestjs-with-...
Support the Channel:
Become a Member: ua-cam.com/users/ansonthedevel...
Become a Patreon: / stuyy
Buy me a Coffee: ko-fi.com/anson
Donate on Streamlabs: streamlabs.com/ansondevacadem...
Donate on PayPal: paypal.me/ansonfoong
Connect with me:
Twitter: / ansonthedev
Discord: / discord
GitHub: github.com/stuyy
Twitch: / stuy
0:00 Introduction
1:00 Project Setup
2:00 Installing & Setting up Mongoose
6:34 Creating a Schema
11:50 Registering Schema
16:00 Injecting a Mongoose Model
26:00 Create & Save User to MongoDB
36:40 Get Data from DB
38:00 Get Data By ID
45:44 Update Data in DB
1:02:00 Delete Data in DB
1:07:12 One-To-One Relationship
1:28:10 Populating Fields
1:32:00 One-To-Many Relationship - Навчання та стиль
I really enjoy your videos as you are thinking out loud as you work out solutions to the various issues that come up...
I was just searching for a tutorial. Since I loved your Websocket tutorial, i can expect this to be another great vid. Cheers
Hope you enjoy it! :)
Very useful content! Thank you very much!
Thanks a lot, I've got new skills now.
I think u are best javascript teacher in youtube . good job bro , thanks
Thank you very much for saying that!
Thanks a lot! so easier and understandable
thanks
Thank you! greate video!
Thank you. Very well!
You are awesome. Thank you.
I am moving from SpringBoot with MongoDB to NestJS with MongoDB. I've tried many videos so that I could relate with my previous knowledge and it is exactly what I was looking for. I've just seen the whole video and I must say it's the one perfect video to get started.👍
Great to hear!
Why u move from spring boot to nest
@@Venkatesh-vm4ll Well, first of all, hardware cost for Springboot app is higher, development is slower because compilation takes time. I work in both technologies though. For large scale projects I use Springboot and for small and medium I use nest.
@@govindbhardwaj_ for larger application u do u don't prefer nestjs
Thank you so much for this amazing video
You're welcome!
It would be great if you made a video about clean architecture with NestJs
Thanks for making this.
You're welcome!
I really like your videos, it's just that, currently, I'm only interested only in Graphql as opposed to REST. Could you specify in the titles if it's REST or Graphql? I watched one of your Nestjs and Graphql videos and I have to say I learned so much there. Thank you so much.
nice video, nest is a bit overcomplicated sometimes, but for really big projects is very cool
Thank you!!!!!!!!!!!!!!!
Para o user você adicionou uma validação (para encontrar um userId se ele existir) no controller, no Post você adicionou validação parecida mas dentro da Service, qual o local ideal para este tipo de validação?
THANK YOU!
You're welcome.
Thank you soo much
Thank you man
You're welcome
Excelente muy bien explicado
thank you
best video
Thanks
greate video! you are super :)
thanks man🤌
Thanks! Very good tutorial I learned a lot. Just a question, wouldn't it be better in the one-to-many relationship to have the userId in the post. Instead of saving all posts ids in the user. Seems like updating a user is an extra query we don't need.
We're not saving all post IDs in the user, that is just how TypeORM requires you to save one to many and many to one relationships.
Nice one
Thanks 🔥
Thanks 🔥
please do a full stack project using angular 17 and nestJs with mangoDB if it is doable! Thank you
great video , , iave a question , lets say on the posts i only want only want to populate the title only when doing a get request how do i do that
Good question, see this: mongoosejs.com/docs/populate.html#setting-populated-fields
how are u writing with cursor that smooth can you tell whats the extention and also the terminal type
It’s a setting in vs code called “smooth cursor”
It was a great tutorial. But if possible please provide the production ready setup it would be very helpful.
Hi, I have a question. Where we defined the id field?
Depending on what your need is, the "id" field is autogenerated by the database. MongoDB will do that for each document by default. If you need additional unique ids you can define them in the schema/model file. Be sure to set the unique constraint too.
Sir What's Your VSCODE font name ?
Operator Mono
Agr sim ❤️
Дякую
👍
nest g resource users --no-spec
User this command and create all the files like module, Dto, controller and service
Do you have any more useful commands?
what's the difference between @IsNotEmpty and @Prop({required:true}) and why we cannot see the user from the post
O meu User não trazia o Settings com o ".populate()" por nada... o erro estava no schema, "ref" estava "Ref" 😅
```
@Prop({ type: mongoose.Schema.Types.ObjectId, Ref: 'UserSettings' })
settings?: UserSettings
```