Node.js Crash Course Tutorial #9 - MongoDB

Поделиться
HTML-код
  • Опубликовано: 28 июл 2024
  • Hey gang, in this Node.js tutorial, we'll hook our node express app up with mongodb, a NoSQL database. Well use mongodb atlas to set up our database online - www.mongodb.com/cloud/atlas/
    0:00 -- intro to mongodb
    2:24 -- mongodb setup with atlas
    6:51 -- mongoose
    19:26 -- getting & saving data
    30:33 -- outputting documents in views
    🐱‍👤🐱‍👤 JOIN THE GANG -
    / @netninja
    ----------------------------------------
    🐱‍💻 🐱‍💻 My Udemy Courses:
    + Modern JavaScript - www.thenetninja.co.uk/udemy/m...
    + Vue JS & Firebase - www.thenetninja.co.uk/udemy/vu...
    + D3.js & Firebase - www.thenetninja.co.uk/udemy/d...
    🐱‍💻 🐱‍💻 Course Files:
    github.com/iamshaunjp/node-cr...
    🐱‍💻 🐱‍💻 Other Related Free Courses:
    + Modern JavaScript Tutorial - • Modern JavaScript Tuto...
    + HTML & CSS Crash Course - • HTML & CSS Crash Cours...
    🐱‍💻 🐱‍💻 Node.js links
    + Download here - nodejs.org/en/download/

Комментарии • 434

  • @lactoseComment
    @lactoseComment 2 года назад +26

    If anyone is struggling to connect to the database, you can try the following
    1. On the mongo site for your database there is a "Network Access' option in the left panel under the 'Security section' - click on this
    2. You will see a green button that allows you to 'Add IP Address', - click on this
    3. A new modal window will appear - you can choose one of two options
    a. Add current IP Address - this will allow you to access the db from the computer you are currently using
    b. Allow Access From Anywhere - this will allow access from any computer - For the purpose of this tutorial I chose this option as my Internet Provider updates the IP Address of my home periodically.
    4. It will take a few seconds to update (you will see a spinner) and once it is complete you should see the 'connected to db' message in your terminal with you restart the application.
    Great tutorials as always Net Ninja! Well worth the money.

    • @ucthainguyen289
      @ucthainguyen289 2 года назад

      Thank u so much! Even though I let mongoDB added my computer IP automatically but the error was still 'because of the wrong IP' so I couldn't connect to the db.

    • @roach5429
      @roach5429 Год назад

      thanks so much man. i was really struggling to connect to my db and this helped

    • @bstech8675
      @bstech8675 9 месяцев назад

      Thanks Dear it works

    • @abdellbouzekri5116
      @abdellbouzekri5116 4 месяца назад +1

      thanks bruh

    • @domiiiiiiiii
      @domiiiiiiiii 3 дня назад

      THANKYOU BRO ❤

  • @thatsalot3577
    @thatsalot3577 Год назад +29

    if you're facing any problems connecting to the cluster, make sure your ip is added to the IP access list under network access tab, mine was changed like 7 times in 5 minutes and after spending so much time I finally understood what's the problem so I always recommend refreshing the network access tab unless you have a static IP.

  • @robbydeleon4872
    @robbydeleon4872 3 года назад +106

    I have learned so much from this teacher. He really know what he's doing.

    • @STUPIDYOUTUBE_HIDINGMSGS
      @STUPIDYOUTUBE_HIDINGMSGS 3 года назад +1

      True, I learned most from his Javascript course in Udemy than most of the tutorials I've seen and paid for and I keep coming back for details whenever I need a refresher on something...

    • @bacon37460
      @bacon37460 2 года назад +2

      That's true. Ninja's tutorials (free or paid) are the best.

    • @SASA_maxillo
      @SASA_maxillo 11 месяцев назад +1

      better than my english teacher 😂😂😂😂

  • @jasonwarner8774
    @jasonwarner8774 3 года назад +9

    High quality tutorial my friend! Just the info we need, concise and clear. Got me up to speed in a jiffy. Cheers

  • @josephmbote4167
    @josephmbote4167 3 года назад +14

    That feeling of gaining more than you Expected from a tutorial, Thanks so much

  • @fredpourlesintimes
    @fredpourlesintimes 2 года назад +1

    Really interesting (if not the best) topic you ever treated on this series.
    Thank you very much. I was looking for a reliable MongoDB tutorial, and it's surely one of the best.

  • @SelvinsStudent101
    @SelvinsStudent101 3 года назад +7

    This is such an awesome set of tutorials! I was initially doing the NodeJS tutorial on W3 schools, but this is so much better. You explain everything very clearly and include lots of important details.

  • @LongNguyen-pe5uo
    @LongNguyen-pe5uo 3 года назад +6

    Awesome tutorial. Was struggling with learning MongoDB but this made it so much easier to learn.

  • @jppontverges
    @jppontverges 4 года назад +5

    Awesome as always ✌✌ thanks for the tutorial, been learning a lot of node this past week

  • @thirashapw
    @thirashapw 4 года назад +10

    Thank you for these tutorials. I really really like your teaching style. And I learned many things from you. really appreciate you❤

  • @NaveenKumar-ts7om
    @NaveenKumar-ts7om 3 года назад

    A week ago i didnt even know anything about the server or backend side of the web d within a week i have ample knowledge to start working on the project ......
    Thanks Net Ninja for creating this series i just love the way you explain things ......
    Thanks A lot.....

  • @geoffdavids7647
    @geoffdavids7647 2 года назад +5

    This is such a brilliant tutorial. I'm a front-end dev trying to speed-learn nodejs and mongodb, and this video sorted me out perfectly with some of the more tricky things to get my head around with database managment (I've not worked directly with databases before). Just getting a free 3rd party online system to manage the database seems like a perfect solution to get started quickly.
    Your style of video presentation and structure are so clear I was able to watch it on 2x speed and still take everything in with no gaps. Incredible! I feel like I'm being jacked into the matrix, brain-fed dev skills at superspeed.

  • @stephaniel.5114
    @stephaniel.5114 4 года назад +40

    I never used the .then and .catch in my projects yet , you made it easier for me to understand its uses. Thank you so much, Sensei. :-D Looking forward to the next!

    • @NetNinja
      @NetNinja  4 года назад +5

      Thanks Stephanie :)

    • @akshaypatel4935
      @akshaypatel4935 4 года назад +10

      @@NetNinja Pleaase make a full series of MERN stack. i am waiting for this from so long.

    • @jojo_koomson
      @jojo_koomson 3 года назад +1

      @@NetNinjaMongooseError: Operation `todos.insertOne()` buffering timed out after 10000ms
      at Timeout. (C:\Users\Solitude\Documents\GitHub
      ode-js-todolist
      ode_modules\mongoose\lib\drivers
      ode-mongodb-native\collection.js:197:23) i krrp getting this error i need help

    • @f12736
      @f12736 2 года назад +1

      @@jojo_koomson
      Is your internet working?

  • @nizarkadri2636
    @nizarkadri2636 3 года назад

    you are the best man !!!! I almost scratched all internet since last week and did not found any better solution than the one you showed ! Thanks a lot !!

  • @harunguven8581
    @harunguven8581 2 года назад +1

    This can be best free learning playlist to really kickstart your backend learning using nodejs. I know some concepts very well now thanks to this course.

  • @jenishshrestha8613
    @jenishshrestha8613 7 месяцев назад

    A great course to get started with node. Talks about all the necessary modules and never misses to get the details .

  • @STUPIDYOUTUBE_HIDINGMSGS
    @STUPIDYOUTUBE_HIDINGMSGS 2 года назад

    Every one of your videos deserve a ton of likes! This one alone has given me so much information that I'm looking for. Thanks for that!

  • @spazzoidrat
    @spazzoidrat 4 года назад +2

    excellent tutorials! been working along side these past few days.

  • @EronMahmuti
    @EronMahmuti 4 года назад +9

    This is what i ve been waiting for hopefully there is going to be another one with html

  • @sabirkhan-tv6xr
    @sabirkhan-tv6xr 4 года назад +19

    You are amazing, never see teacher like you. Sir after this series will you make advance node js series, like you said in first video

  • @user-qy3jb6ot8p
    @user-qy3jb6ot8p Год назад

    honestly iI have been trying to understand node js and express and this is the only course I have had a proper understanding of the concepts, thank you

  • @icycounter-strikeandleague8431
    @icycounter-strikeandleague8431 3 года назад

    Sir, you are briliant at explaining, I have searched a lot of videos but you are the best one.

  • @raffritter6766
    @raffritter6766 4 года назад +2

    Very straight foreward style, I like it!

  • @fadygamilmahrousmasoud5863
    @fadygamilmahrousmasoud5863 3 года назад

    i really need to thank you, the whole series is amazing..

  • @oscarjarquin-pablo6320
    @oscarjarquin-pablo6320 Год назад +5

    Thank you, man, you helped me so much during this time where procrastination is brutal with finals. Your tutorial was the only one that truly made sense. I applaud you for making this completely free.

  • @francomacias8904
    @francomacias8904 4 года назад +1

    The Net Ninja is the best teacher I've ever had!!! I'm not that young but I guess old dog can learn new tricks after all, I'm almost 50 but I'm absorbing with no problems whatsoever thanks to the magnificent teaching skills of our magnificent Net Ninja Shifu Grand Master, I just to had to join the team!!!! Thanks for sharing your knowledge Maestro!!!

  • @HakanGalip
    @HakanGalip 2 года назад

    Great Tutorial and my third one with net ninja as my teacher. Learned a lot, clear and very understandable stuff.
    Thank´s a lot...

  • @johnpzaccari
    @johnpzaccari 3 года назад

    You are the man! Thank you so much for making these tutorials!

  • @Joe-ka
    @Joe-ka 3 года назад +1

    I wish that i can like this video 10000 times , mongoose was pain to me and now i understand it , Thank you!
    Liked and subscribed!

  • @oscarmartinlive
    @oscarmartinlive 4 года назад +154

    I’m first attracted to your voice, then your accent, then your knowledge. I so wanna be your friend, really.

  • @dueft4479
    @dueft4479 3 года назад +1

    Best tutorial of MongoDB I've seen so far :D

  • @biz3104
    @biz3104 3 года назад +49

    6:10 *Never use your password and account id in a code you are going to share* with others (for example a GitHub repository)!
    Same goes to API keys, or anything you use to access something. People will steal your account if you don't take this seriously, and if it is a paying subscription, you will need to pay huge amounts for that mistake, not to mention the damage they can do to your users, if you are storing sensitive data.
    There is a way to use usernames and passwords safely. Please look up .env or dotenv to learn about environmental variables and how to use them.
    I understand why this was not included here in the lesson, but I believe it is very important to know.

    • @surge2284
      @surge2284 2 года назад +3

      It was for the sack of the vid

    • @spiritech7162
      @spiritech7162 Год назад

      @@surge2284 for sack of the weed

  • @badripaudel77
    @badripaudel77 3 года назад +5

    One of my favorite instructors ❤️❤️❤️

  • @brandongounder3632
    @brandongounder3632 4 года назад +1

    Thank you Net Ninja. I am really enjoying this series. Brandon(South Africa)

  • @ScottBaker38
    @ScottBaker38 3 года назад +5

    I got stuck for 30 minutes on an error "Blog is not a constructor" until I realized I typed "module.export" instead of "module.exports" at the end of blog.js >_<
    The version on the repo saved me. So glad it's part of this tutorial.

    • @abigailsmith6000
      @abigailsmith6000 3 года назад +1

      I was just having the same problem, glad your comment fixed it for me!

    • @TheDannos
      @TheDannos 2 года назад +1

      Same here, thanks for the comment!

  • @radejradej
    @radejradej 2 года назад

    What a great tutorial. Fantastic knowledge, struture and communication skills.

  • @testlan7765
    @testlan7765 6 месяцев назад

    explained so well. nice work. save me tons of time to bring back the memories of front-end coding.

  • @Shakeel714
    @Shakeel714 3 года назад +3

    Very helpful tutorial. I already learned a lot about NodeJS from this wonderful series

    • @NetNinja
      @NetNinja  3 года назад

      Glad you enjoyed it! :)

  • @ZinkIThink
    @ZinkIThink 2 месяца назад

    Absolutely incredible video! You walked through every step in a very clear and simple manner. Please keep up the great work!

    • @NetNinja
      @NetNinja  2 месяца назад

      Thanks Zink, that means a lot :) cheers for watching

  • @venkatakalyan8330
    @venkatakalyan8330 3 года назад +1

    really very well explained mongo db and mongoose i never seen this tutorail like this you explained really welll in simple manner and easy to understand thank you make this tutorail ninja 👏

  • @pablofonseca8867
    @pablofonseca8867 4 года назад +9

    Amazing Ninja, you are a wonderful guy, thank you so so much, you have no idea how much you have helped me. Master.

    • @NetNinja
      @NetNinja  4 года назад +2

      You are very welcome :)

  • @cloudybrains
    @cloudybrains 3 года назад

    Nice video! I was trying to manage a MongoDB database on a digital ocean server but it was such a hassle to not be able to push things directly from my computer to the database. MongoDB Atlas makes this way more efficient.

  • @brandyatieno5238
    @brandyatieno5238 Год назад +1

    Grateful for the amazing work you do ... ✊

  • @omatsoladev
    @omatsoladev 2 года назад

    when you teach , it's like i can see you one on one explaining to me in person, thanks so much Sir

  • @ArturKRG
    @ArturKRG 3 года назад +47

    16:49 I laughed so hard on that titmestamp xD

    • @mwaqze
      @mwaqze 3 года назад +1

      And I have been wondering the whole time till I reached that specific timestamp.

    • @STUPIDYOUTUBE_HIDINGMSGS
      @STUPIDYOUTUBE_HIDINGMSGS 3 года назад +1

      yeah, I was about to say this but you beat me to it, lol.

    • @yousufsulaiman2211
      @yousufsulaiman2211 3 года назад

      @Artur Gairhanov Can u tell me what is make you laughing so hard? I wonder to know that, So I will laugh like you!

    • @f12736
      @f12736 2 года назад

      @@yousufsulaiman2211
      Tit maybe 😜

  • @juliocidb
    @juliocidb 3 года назад +1

    Llevo los 9 videos hasta ahora y estoy fascinado con todo lo que aportas, la info es realmente útil y muy bien explicado incluso para alguien que su lengua nativa no es el inglés. Muchas gracias

    • @jamespawson6045
      @jamespawson6045 3 года назад +1

      I’ve watched the 9 videos up to now and I’m fascinated by everything that you upload. The information is really useful and really well explained. Even for someone whose first language isn’t English. Thank you very much.

    • @juliocidb
      @juliocidb 3 года назад +1

      @@jamespawson6045 Such a great guy, I really appreciate that dude

    • @jamespawson6045
      @jamespawson6045 3 года назад

      @@juliocidb de nada :-) apenas para que el podra leerlo

  • @ctngaming260
    @ctngaming260 Год назад

    thanks 2x! 1 time for the basics, the second time for actually initializing my full app and releasing it! :D

  • @standardman6535
    @standardman6535 3 года назад +6

    he sounds like that one teacher you look forward to having

  • @tomosterlund6497
    @tomosterlund6497 4 года назад

    This really helped me. Big thanks!

  • @tekliebelay4896
    @tekliebelay4896 3 года назад

    You're the best. Glad I came across your videos :)

  • @irvirv8243
    @irvirv8243 3 года назад

    Really good explanation it makes it so easy for understanding. Keep the good work.

  • @MrZeffy
    @MrZeffy 3 года назад

    This guy is amazing. Loved the video.

  • @AminulislamSakib
    @AminulislamSakib 3 года назад +1

    You are really awesome man. Love for you

  • @mickaelrichard7255
    @mickaelrichard7255 3 года назад +1

    Cant wait for a MERN stack full project tutorial from the best instructor of the web :)

  • @jomarkpangan9362
    @jomarkpangan9362 4 года назад +2

    This is really neat. Before arriving to this crash course, I was doing The Odin Projects' nodeJS tutorial and it didnt click for me because there's a lot of copy paste to do. Meanwhile, you explain everything line by line. Great Stuff! If I ever landed a job, I assure you I'll give back to you.

    • @NetNinja
      @NetNinja  4 года назад +1

      Thanks so much :)

  • @santra528
    @santra528 3 года назад +8

    I was watching a paid course and then I watched one video of this series. OMG!! This video series is waaaaaaaayyy better than those paid Udemy courses!! Why are you some so awesome man!! Net Ninja that is not allowed💖

  • @soyabogadodeldiablo
    @soyabogadodeldiablo 2 года назад

    Thank you so much for this great tutorial. You explain so well and step by step. I'm a new subscriber.

    • @NetNinja
      @NetNinja  2 года назад +1

      Thank you Darío :)

  • @yousufkhan2909
    @yousufkhan2909 3 года назад +2

    You are a super star. 1000000s of stars for you dear. Best teacher by miles

  • @nerdbrainz
    @nerdbrainz 3 года назад

    Thank you for all the knowledge brother. I really appreciate it.

  • @stanisawjarocki1747
    @stanisawjarocki1747 Год назад +6

    I've learned exactly what I need from this course. You've truly done an amazing job!

    • @NetNinja
      @NetNinja  Год назад +3

      Thank you so much for your support Stanisław!

  • @dennisgonzales9521
    @dennisgonzales9521 4 года назад +6

    Just a humble suggestion from your avid subscriber.
    Consider doing Firebase Cloud Messaging(FCM) next as a series of tutorial.
    And as always, awesome video :)

    • @NetNinja
      @NetNinja  4 года назад +10

      Hey, thanks. It's not the next on the list but I will be doing this at some point :)

  • @victorfelizardoviageiro8438
    @victorfelizardoviageiro8438 3 года назад +1

    Hi! loving the course. I have a question, when we work with php and Mysql we need to connect and close the connection , do we need to consider that working with node and Mongo?

  • @neokatwastaken
    @neokatwastaken 3 года назад

    you are a lifesaver. Thank you so much!!

  • @evenyoucancode
    @evenyoucancode 3 года назад

    This is Gold. Thank you.

  • @MJ46.91
    @MJ46.91 3 года назад

    I was so stupid and the first 5 minutes in your video saved me thanks !

  • @mythicalwraith7026
    @mythicalwraith7026 4 года назад

    Love your videos!!

  • @hamzaseif4992
    @hamzaseif4992 2 года назад

    The voice quality is very unique, thanks for the vedio sir ♥️

  • @Misfittykitty
    @Misfittykitty 2 года назад

    This course is the absolute best, you are such a great teacher, thank you!! I am having a problem because when I go in to create a cluster it just hangs and hangs. I checked the mongoDB status page and it says everything is fine, no significant delays. This has been creating for over an hour. The last one I tried to create hung forever. I created it in June and today when I logged in it was still spinning so I deleted it... Any suggestions appreciated. :)

  • @danielfennerdev
    @danielfennerdev 2 года назад

    Love the tutorial - I was wondering what the really short answer is to when is best to use a SQL database vs a NoSQL database?

  • @cryswerton-silva
    @cryswerton-silva 3 года назад

    Good job man! Thanks a lot!!

  • @boriszolah3770
    @boriszolah3770 Год назад

    you should be one of the most popular channels out there, full suport, great work

  • @lucasbss
    @lucasbss 3 года назад +1

    Hell yes!! i finally get it!

  • @elmoutaouakkilmohammed1432
    @elmoutaouakkilmohammed1432 2 года назад

    Wonderful tutorial .
    Thank you very much

  • @nigelpallatt
    @nigelpallatt 2 года назад +1

    Man, I had such a hard time connecting to the DB finally used an IP address of any and it worked

    • @ahmedfattal9569
      @ahmedfattal9569 2 года назад +1

      I had the same problem and I used what you mentioned above! I have another problem now which is when I'm using the sandbox routes
      the nodemon app crashed saying waiting for file changes before starting... Do you this problem or not?

  • @limitless003
    @limitless003 10 месяцев назад

    Thank a lot , you made hard topic's simple. You are the best !

    • @NetNinja
      @NetNinja  10 месяцев назад

      Glad to hear that! :)

  • @aram5642
    @aram5642 2 года назад

    One of the most charming conundrums: schemas aiming at providing structure for a non-structured database ;-)

  • @vijayhegde2328
    @vijayhegde2328 3 года назад

    thank you for the crash course, it is really helping me to understand node js as dummy developer. Due to you have something for Angular?

  • @iamfemilight5987
    @iamfemilight5987 2 года назад +1

    thanks for this incredible tutorial

  • @nasseurabdelhak2942
    @nasseurabdelhak2942 3 года назад

    hey brother thanks for your efforts i really appreciated. even if i felt that express is light version of django. but great tutorial thanks

  • @hamzafarhan348
    @hamzafarhan348 4 года назад +6

    bro i love u i just ask u to do this a lot of thanks ♥

  • @IcyyDicy
    @IcyyDicy 3 года назад

    Very helpful, thank you!

  • @namjotsingh
    @namjotsingh 6 месяцев назад

    such a informative content. learned a lot from this video . Thank you.♥

    • @NetNinja
      @NetNinja  6 месяцев назад +1

      Glad it was helpful! :) thanks for watching

  • @streamx2
    @streamx2 3 года назад +1

    I love your courses. I take your follow them on here and on Udemy. I struggled with Mongoose, I wish you had a mini series on it that I could follow before taking this course.

    • @NetNinja
      @NetNinja  3 года назад +1

      I will probably do a small mongo course at some point!

    • @streamx2
      @streamx2 3 года назад +1

      @@NetNinja thank you. Mongo itself is easy to understand and there are lots of courses for it. Mongoose makes it hard, so i think the ficus should be on Mongoose.

  • @javaskull
    @javaskull 2 года назад

    Hey that was a nice refresher.

  • @BonJoviFan13
    @BonJoviFan13 3 года назад

    In the part where you have app.listen during the then statement, what would you recommend if my database connection is on a different js file than my app.js? I try to have as many js files as I can to keep my code small and organized.

  • @copaceticobserver
    @copaceticobserver 2 года назад

    I'm going to need to rewatch this a couple of times

  • @barebackhippo6616
    @barebackhippo6616 2 года назад

    I was stuck for so long until I found your video. I was connected to the DB but was unable to save POST requests. Turns out I had written my model name incorrectly and it didn't match the collections name in the db. Thank you!

  • @codedynamics1
    @codedynamics1 3 года назад

    @netnija thanks for this awwsome video!! You are one of my favourite online tutors along with Brad Traversy but i have a small issue. Do you mean CRUD instead of SRUD save, read, update and delete because i have never heard of that before. I have googled everywhere and all that gets return is CRUD which i believe is the correct terminolgy ?

  • @pipertime1
    @pipertime1 3 года назад

    Great teaching! We need a node course on Udemy with deep dive in Express and Axios. You can't find teaching on Axios and with Multiple Axios Requests simultaneously using axios.spread.

  • @arjunparmani560
    @arjunparmani560 4 года назад

    I am getting 2 entries in the db while adding just one, how should i rectify that?

  • @alfabinomial6183
    @alfabinomial6183 Год назад

    best tutorial in the world !!! SIR

  • @yinonb172
    @yinonb172 4 года назад

    best node.js tutorial ever

  • @minnininja4777
    @minnininja4777 4 года назад

    Advance congratulations for your 0.5 Million subscribers

  • @himanshunahak5105
    @himanshunahak5105 4 года назад

    Hi Shaun, you rock!

  • @ericpodhorecki5427
    @ericpodhorecki5427 3 года назад

    such a good course!

  • @user-my6dw8xd9k
    @user-my6dw8xd9k Год назад

    I love the way how y pronounce "require" ))) Thnx for great tuts

  • @EnesKab
    @EnesKab 3 года назад

    Dude, you are more superhero than the Spiderman to me. 😊

  • @fersalamanca2606
    @fersalamanca2606 2 года назад +2

    Hey man! Amazing tutorial! I just have a doubt regarding when to use get vs post methods. In the sandbox route where you create a blog, shouldn’t it be a post instead? I’m new to this so I still get confused a little by this. Thanks in advance!

    • @AlbanLeong
      @AlbanLeong 2 года назад +1

      If you're coding a RESTful API with Node, then you should definitely follow the HTTP VERB guidelines, which is to use GET, POST, PATCH and DELETE as expected. However, if you're just coding a sandbox type application or not really creating a RESTful API, then, I think it's not entirely wrong to follow the approach here in this video... just my conclusion as I had the same thought when I watched this

  • @tubhmoobvideochannel7606
    @tubhmoobvideochannel7606 4 года назад

    Hi....Sir. I need to know create slide show image automatic in visual studio code.please help me?

  • @rogerpantil5025
    @rogerpantil5025 Год назад +1

    in current version Clusters is now called Database
    Clusters -> Database