NestJS with MongoDB & Mongoose - FULL BEGINNER TUTORIAL
Тәжірибелік нұсқаулар және стиль
Code: github.com/stuyy/nestjs-with-...
Support the Channel:
Become a Member: kzread.info...
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
Пікірлер: 53
I really enjoy your videos as you are thinking out loud as you work out solutions to the various issues that come up...
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.👍
@ansonthedev
Ай бұрын
Great to hear!
I was just searching for a tutorial. Since I loved your Websocket tutorial, i can expect this to be another great vid. Cheers
@ansonthedev
6 ай бұрын
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
@ansonthedev
4 ай бұрын
Thank you very much for saying that!
Thank you. Very well!
Thank you! greate video!
Thank you so much for this amazing video
@ansonthedev
5 ай бұрын
You're welcome!
It would be great if you made a video about clean architecture with NestJs
Thanks for making this.
@ansonthedev
6 ай бұрын
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 man
@ansonthedev
6 ай бұрын
You're welcome
THANK YOU!
@ansonthedev
5 ай бұрын
You're welcome.
Excelente muy bien explicado
thank you
greate video! you are super :)
Thank you soo much
Thank you!!!!!!!!!!!!!!!
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.
@ansonthedev
2 ай бұрын
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.
best video
Thanks
It was a great tutorial. But if possible please provide the production ready setup it would be very helpful.
Nice one
@ansonthedev
2 ай бұрын
Thanks 🔥
@ansonthedev
2 ай бұрын
Thanks 🔥
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?
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
@ansonthedev
6 ай бұрын
Good question, see this: mongoosejs.com/docs/populate.html#setting-populated-fields
thanks man🤌
how are u writing with cursor that smooth can you tell whats the extention and also the terminal type
@ansonthedev
6 ай бұрын
It’s a setting in vs code called “smooth cursor”
please do a full stack project using angular 17 and nestJs with mangoDB if it is doable! Thank you
Hi, I have a question. Where we defined the id field?
@ansonthedev
3 ай бұрын
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.
Agr sim ❤️
Дякую
nest g resource users --no-spec User this command and create all the files like module, Dto, controller and service
@ns-gabrielmendoza1329
Ай бұрын
Do you have any more useful commands?
Sir What's Your VSCODE font name ?
@ansonthedev
6 ай бұрын
Operator Mono
👍
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 ```
what's the difference between @IsNotEmpty and @Prop({required:true}) and why we cannot see the user from the post