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
  • Навчання та стиль

КОМЕНТАРІ • 58

  • @unhandledexception1948
    @unhandledexception1948 6 місяців тому +3

    I really enjoy your videos as you are thinking out loud as you work out solutions to the various issues that come up...

  • @yuripires9025
    @yuripires9025 7 місяців тому +2

    I was just searching for a tutorial. Since I loved your Websocket tutorial, i can expect this to be another great vid. Cheers

  • @sergeyplotnikov4303
    @sergeyplotnikov4303 6 місяців тому

    Very useful content! Thank you very much!

  • @esther44450
    @esther44450 2 місяці тому

    Thanks a lot, I've got new skills now.

  • @mehmetaliuyar3051
    @mehmetaliuyar3051 5 місяців тому

    I think u are best javascript teacher in youtube . good job bro , thanks

    • @ansonthedev
      @ansonthedev  5 місяців тому

      Thank you very much for saying that!

  • @abirkolin4702
    @abirkolin4702 19 днів тому

    Thanks a lot! so easier and understandable
    thanks

  • @user-jm8py4fu8u
    @user-jm8py4fu8u 5 місяців тому

    Thank you! greate video!

  • @nalcapital
    @nalcapital 7 місяців тому

    Thank you. Very well!

  • @frankameh257
    @frankameh257 19 днів тому

    You are awesome. Thank you.

  • @govindbhardwaj_
    @govindbhardwaj_ 3 місяці тому +2

    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
      @ansonthedev  3 місяці тому

      Great to hear!

    • @Venkatesh-vm4ll
      @Venkatesh-vm4ll 13 днів тому

      Why u move from spring boot to nest

    • @govindbhardwaj_
      @govindbhardwaj_ 10 днів тому

      @@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.

    • @Venkatesh-vm4ll
      @Venkatesh-vm4ll 10 днів тому

      @@govindbhardwaj_ for larger application u do u don't prefer nestjs

  • @overrevvv
    @overrevvv 7 місяців тому

    Thank you so much for this amazing video

  • @sergeyplotnikov4303
    @sergeyplotnikov4303 6 місяців тому +2

    It would be great if you made a video about clean architecture with NestJs

  • @prashlovessamosa
    @prashlovessamosa 8 місяців тому

    Thanks for making this.

  • @MG-wx8yx
    @MG-wx8yx 2 місяці тому

    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.

  • @user-mp6fw3ii2x
    @user-mp6fw3ii2x 4 місяці тому

    nice video, nest is a bit overcomplicated sometimes, but for really big projects is very cool

  • @charlesorafu490
    @charlesorafu490 2 місяці тому

    Thank you!!!!!!!!!!!!!!!

  • @darlleybrito4198
    @darlleybrito4198 Місяць тому

    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?

  • @user-fb6he4vb1u
    @user-fb6he4vb1u 6 місяців тому

    THANK YOU!

  • @abdrahim9307
    @abdrahim9307 3 місяці тому

    Thank you soo much

  • @awaraamin6850
    @awaraamin6850 7 місяців тому

    Thank you man

  • @josbexerr5166
    @josbexerr5166 Місяць тому

    Excelente muy bien explicado

  • @sentinel435
    @sentinel435 2 місяці тому

    thank you

  • @RlflrRLflr
    @RlflrRLflr 8 місяців тому +1

    best video

  • @user-gj8sh9gx9r
    @user-gj8sh9gx9r 4 місяці тому

    Thanks

  • @boss-rus
    @boss-rus 6 місяців тому

    greate video! you are super :)

  • @selimolmaz2896
    @selimolmaz2896 5 місяців тому

    thanks man🤌

  • @alepaez3897
    @alepaez3897 4 місяці тому

    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
      @ansonthedev  4 місяці тому

      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.

  • @riyazmusics483
    @riyazmusics483 3 місяці тому

    Nice one

  • @awaraamin6850
    @awaraamin6850 5 місяців тому +1

    please do a full stack project using angular 17 and nestJs with mangoDB if it is doable! Thank you

  • @pateltanaka49
    @pateltanaka49 7 місяців тому

    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
      @ansonthedev  7 місяців тому +1

      Good question, see this: mongoosejs.com/docs/populate.html#setting-populated-fields

  • @omarh.soliman6814
    @omarh.soliman6814 7 місяців тому

    how are u writing with cursor that smooth can you tell whats the extention and also the terminal type

    • @ansonthedev
      @ansonthedev  7 місяців тому +1

      It’s a setting in vs code called “smooth cursor”

  • @rahulkumarbarnwal5978
    @rahulkumarbarnwal5978 3 місяці тому

    It was a great tutorial. But if possible please provide the production ready setup it would be very helpful.

  • @apple1697
    @apple1697 5 місяців тому

    Hi, I have a question. Where we defined the id field?

    • @ansonthedev
      @ansonthedev  4 місяці тому

      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.

  • @polymath-403
    @polymath-403 8 місяців тому

    Sir What's Your VSCODE font name ?

  • @PedroHMelo
    @PedroHMelo 8 місяців тому

    Agr sim ❤️

  • @user-br8kr3qj6y
    @user-br8kr3qj6y 2 місяці тому

    Дякую

  • @sahakhovhannisyan1418
    @sahakhovhannisyan1418 4 місяці тому

    👍

  • @gorfadumesh326
    @gorfadumesh326 4 місяці тому +1

    nest g resource users --no-spec
    User this command and create all the files like module, Dto, controller and service

  • @phantazzor
    @phantazzor Місяць тому

    what's the difference between @IsNotEmpty and @Prop({required:true}) and why we cannot see the user from the post

  • @darlleybrito4198
    @darlleybrito4198 Місяць тому

    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
    ```