Mongoose schema in node js | CRUD operation in node js with try catch statement

Sdílet
Vložit
  • čas přidán 24. 07. 2024
  • Hey everyone, In this Node.js video, we cover the creation of a Node.js project and connecting Mongoose with Node.js for effective database interactions. The course delves into Mongoose models and schemas, addressing client-to-server communication and the implementation of the POST method in Node.js Express. Participants learn about HTTP status codes, creating a POST API, and dealing with callback function issues. Further topics include asynchronous programming with async/await in JavaScript, error handling with try and catch, validating Mongoose schemas in Node.js, and understanding the GET method. The course concludes with a comprehensive exploration of CRUD operations in Node.js, emphasizing the importance of Mongoose schemas in building robust applications.
    🌟🌟 Notes & Assignment: topmate.io/helloworldbyprince...
    🔥 NodeJS Complete Playlist: • NodeJS Tutorial For Be...
    NodeJS Bootcamp [ Day 5 ]
    🔥 For the Free NodeJS course, Please Do comments and like as much as you can
    ❤️ Like Aim: 500
    ❤️ Comments Aim: 350
    Hit that like button, subscribe, and ring the notification bell to never miss a frustration-busting tip! Let's crush those DSA challenges and make learning fun again! 🚀📚
    ----------------------------------------------------------------------------------------
    Follow me on:
    💼 LinkedIn► / iamprince
    📷 Instagram► / helloworldbyprince
    🐦 Twitter► / prince_king_
    📲 Telegram► telegram.me/helloworldbyprince
    📘 Facebook► / helloworldofficials
    ----------------------------------------------------------------------------------------
    ▬ Contents of this video ▬▬▬▬▬▬▬▬▬▬
    00:00 Recap of mongodb
    00:40 Create nodejs project
    01:10 Connect Mongoose with node js
    15:01 models in mongoose
    17:56 Schema in node js
    27:24 body parser in node js
    32:24 client to server communication
    33:13 post method in node js express
    37:51 HTTP status codes
    38:36 post api in node js
    39:45 issue with callback function
    41:05 async await javascript
    44:22 try and catch in javascript
    49:24 Mongoose validate schema in node.js
    52:07 GET method in node js
    55:13 CRUD operation in node js
    59:17 mongoose schema node js
    01:04:56 Summary of Nodejs
    ----------------------------------------------------------------------------------------
    ►Our Playlists on:-
    🔥 Tree: • Tree Data Structure & ...
    🔥 Stack & Queue: • Stack & Queue Data Str...
    🔥 Hashing: • Hashing Data Structure...
    🔥 Graph: • Graph Data Structure &...
    🔥 Matrix: • Matrix (Multidimension...
    🔥 Recursion & DP: • Recursion
    🔥 Heap: • Heap Data Structure & ...
    🔥 Linked List: • Linked List Data Struc...
    🔥 STL: • Standard Template Libr...
    🔥 Leetcode: • LeetCode Solutions And...
    🔥Competitive Programming: • Full course in Competi...
    🔥 C++ Full Course: • C++ full Course in HINDI
    🔥 Algorithms: • L-01 || Prefix Sum Arr...
    🔥 Data Structure: • Data Structures with C...
    ------------------------------------------------------------------------
    🌟 Please leave a LIKE ❤️ and SUBSCRIBE for more AMAZING content! 🌟
    ✨ Tags ✨
    #nodejs #mongodb #mongoose #nodejs #programming #coding #programminglanguage #javascript #mongodb #tutorial #learning #leetcode #linkedin #webdev #webdeveloper #webdevelopment #development #developers #layoffs #pythonprogramming #java #javatutorial #bootcamp #course #coder #programminglife #node #nodejstutorial #nodejsdevelopment #princebhai #program #codes #js #cplusplusprogramming #programminglanguage #python #geeksforgeeksgate #leetcodesolutions #dsa #dsalgo #algorithm #datastructure #hindi #mongodbtutorialforbeginners #database #faang #google #microsoft #array #vector #golanguage #helloworld #node #technology #internship #job #jobsearch
    node js
    node js in hindi
    node js by prince
    nodejs prince
    node js tutorial
    node js projects
    nodejs event loop
    nodejs microservice
    node js interview
    node js playlist
    node js API
    node js thapa
    node js crash course
    node js tamil
    node js express
    node js backend
    node js interview questions
    node js tutorial in hindi
    node js tutorial playlist
    node js tutorial by prince
    node js developer
    node js developer roadmap
    node js developer interview
    nodejs api development
    node js developer full course
    node js developer job
    node js developer resume
    #nodejs #mongodb #mongoose
    Comment "#Princebhai" if you read this 😉😉

Komentáře • 313

  • @akshayshrivastava6057
    @akshayshrivastava6057 Před 4 měsíci +25

    For most of the user's like me questioning where does that collection name "people" came .let's have some explanation.(say thanks as I have done research for you).😁😁.
    In Mongoose, if you create a model without explicitly specifying a collection name, Mongoose will pluralize the name of the model to determine the collection name. In your case, since your model is named "Person", Mongoose will pluralize it to "people" and use that as the collection name by default. This is a common convention in MongoDB and Mongoose for naming collections.
    If you want to explicitly specify a different collection name, you can do so by passing the desired collection name as the third argument when creating the model using mongoose.model(). For example:
    "const Person = mongoose.model('Person', personSchema, 'my_custom_collection_name');"

    • @2719yash
      @2719yash Před 2 měsíci

      Bro can you plz. share notes

    • @messi69goat
      @messi69goat Před měsícem +1

      anyone help in my terminal it only shows connected to mongo server it doesnt shows disconnection although i stop the mongo server

    • @akshayshrivastava6057
      @akshayshrivastava6057 Před měsícem

      @@messi69goat hi please share more info on it

    • @messi69goat
      @messi69goat Před měsícem

      @@akshayshrivastava6057 in the video when we start mongo server the terminal print saying the server is connected and when we stop server it will say disconnected but in my case it doesn't says it is disconnected what should I do although it says it's connected

    • @rishabhsingh1492
      @rishabhsingh1492 Před měsícem +1

      Thanks bhai

  • @AJ-wf3wp
    @AJ-wf3wp Před 6 měsíci +12

    guys plz keep liking the video....for his motivation

  • @user-rb2di2hu4p
    @user-rb2di2hu4p Před měsícem

    hats off, I tried so many courses to learn back end this is the bestest and most easilyy understandable. I pray god gives u so much success and so many subscribers u really deserve it. I will be sitting for placement in august and this videos make me feel very hopeful. thank you

  • @ShivamBhawel-zq1fg
    @ShivamBhawel-zq1fg Před 4 měsíci +1

    bohot sahi study krwate he bhaiya.....Thank u so much....
    .

  • @Kabir-777
    @Kabir-777 Před 6 měsíci +6

    A perfect course for node.js and backend as well. Much more then a paid course. Please don't leave it incomplete 🥰😘

  • @MAYANKSINGH-mf2ll
    @MAYANKSINGH-mf2ll Před 3 měsíci

    Thanks Bhaiya for the Amazing Course and hardwork you put in this course 😍
    Literally speaking ,this course has boost my confindence

  • @rishikagoyal8043
    @rishikagoyal8043 Před 3 měsíci +2

    Top notch content. I wish you get a millions of subscribers this year🤞

  • @AkashSharma-lf5jq
    @AkashSharma-lf5jq Před 3 měsíci +1

    Maza aagya bhaiya pdhke aapse concepts clear hogye

  • @anonymous090
    @anonymous090 Před 5 měsíci

    homework krte hai bhaiya... these lectures are amazing

  • @yashparashar6781
    @yashparashar6781 Před 5 měsíci +1

    Thank you for the course😇

  • @minecraftcookie2929
    @minecraftcookie2929 Před 2 měsíci

    Thanks so much for this amazing course

  • @WebartMorning
    @WebartMorning Před 29 dny

    thank you , this is very simple to undersatnd

  • @vedbhanushali608
    @vedbhanushali608 Před 6 měsíci +6

    was waiting for this 👍🏻

  • @shashankkhare-zw1ie
    @shashankkhare-zw1ie Před 2 měsíci

    One of the best node.js tutorial. Great explaination

    • @2719yash
      @2719yash Před 2 měsíci

      Bro can you plz. share notes

  • @theTrendy23
    @theTrendy23 Před 6 měsíci

    Thanks bhai for world best node course

  • @codin7367
    @codin7367 Před 4 měsíci

    prince bro the way you teach is fabulous and makes complex topics digestible... I am currently looking for job as a fresher but people wants only experienced others are not responding😢

  • @NikhilChoudhary-hi6fo
    @NikhilChoudhary-hi6fo Před 3 měsíci +1

    best of best bhai ...Thanku so much.....
    Truly Helpfull

  • @lohitkumarpatra6906
    @lohitkumarpatra6906 Před 6 měsíci +1

    well explain bhaiya,homework done...

  • @vikash.pandey1550
    @vikash.pandey1550 Před 9 dny

    thanks bhaiya you deserve a million followers

  • @abhishektyagi5941
    @abhishektyagi5941 Před 6 měsíci +5

    I'm not the person who comments on any of the videos, but the way you teach is just amazing.
    I am grateful that I found your channel when I started learning the backend.
    Thanks a lot, already subscribed to your channel.

    • @HelloWorldbyprince
      @HelloWorldbyprince  Před 6 měsíci +2

      I am soo happy for such positive vibes
      Keep learning and pls share as much as you can to support our channel

    • @VaishaliSharma374
      @VaishaliSharma374 Před měsícem

      Hey can you please help me out,
      While downloading mongoDB, a file named 'mongo.exe' has to be downloaded, which when i download it got downloaded with the name 'mongo' only.
      When I'm trying to connect mongoDB server with node.js server, it is not gteting connected.
      Is this issue came coz of not downloding 'mongo.exe' file properly ?

  • @vibha3031
    @vibha3031 Před 2 měsíci

    maza aagya bhaiya !! great lecture

  • @Vanshit_Patel
    @Vanshit_Patel Před 2 měsíci

    Ek number bhai easy to learn and understand aapne bataya he 👍

    • @2719yash
      @2719yash Před 2 měsíci

      Bro can you plz. share notes

  • @Fun044
    @Fun044 Před 24 dny

    Thank you very much Sir for making such lecture deep explaination along with notes and Error handling better than many paid courses hats of you Sir dil se Shhukriya 🤍

  • @user-th4uz6vg1d
    @user-th4uz6vg1d Před 6 měsíci +1

    Thank you bhaiya 💙🎉

  • @anonymous090
    @anonymous090 Před 5 měsíci

    Thank you bhaiya... learned a lot

  • @junaiid0104
    @junaiid0104 Před měsícem

    crazy playlist sir !!!!!

  • @user-uq8yd4lj7t
    @user-uq8yd4lj7t Před 3 měsíci

    best
    explaination
    ever

  • @bhushan321
    @bhushan321 Před 6 měsíci +1

    Good explanation 👏 👍

  • @_hulk748
    @_hulk748 Před měsícem

    Wonderful Video sir🙏🙇‍♂✨💖

  • @aritrakhatua8210
    @aritrakhatua8210 Před 6 měsíci +2

    Definitely better bootcamp than a so called Udemy Course

  • @yashu1703
    @yashu1703 Před 6 měsíci +2

    Best video ❤

  • @dynegaming
    @dynegaming Před 3 měsíci

    Really useful of me ❤

  • @anandsinha2289
    @anandsinha2289 Před 5 měsíci

    maja a gya bhaiya inta acha padhane ke liye dil se sukriya 🚀🚀🥰😘

  • @nehathakur40
    @nehathakur40 Před 5 měsíci

    Best bootcamp for beginners

  • @user-fh2wy2zv2i
    @user-fh2wy2zv2i Před 6 měsíci +3

    successfully done 🙂

  • @AYUSHKUMAR-xj4wc
    @AYUSHKUMAR-xj4wc Před 3 měsíci

    Amazing!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @062nayemurrahman8
    @062nayemurrahman8 Před 6 měsíci +2

    You deserve more subscribers brother. Thanks for your service❤

  • @bhaktisharma9681
    @bhaktisharma9681 Před 5 dny

    thanks brother good videos

  • @sandeepkumarg1889
    @sandeepkumarg1889 Před 6 měsíci +2

    Great lecture sir🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏

  • @nitink8148
    @nitink8148 Před 2 měsíci

    Excellent!!

  • @Chiragsanikam.
    @Chiragsanikam. Před 4 měsíci

    Thank you so much

  • @Uvistix
    @Uvistix Před 2 měsíci

    Your the best🌟🌟🌟🌟🌟

  • @durgfestivalvibes
    @durgfestivalvibes Před 7 dny

    badhiya!!!!!

  • @Pallavi25010
    @Pallavi25010 Před měsícem

    Jo aapne postman me person data likha tha / laga ke jisme name and other details likhi thi wo kaha pe bana ke rakha tha ??.uska koi folder ni dikha ?jaise idli sambhar wala data to banaya tha ek folder me par ye wala ni dikha kaha banaya?

  • @learn_Coding
    @learn_Coding Před 6 měsíci

    Thank you sir ji
    You are great

  • @The_Developer_
    @The_Developer_ Před 4 měsíci

    best for beginner

  • @ridwanrahaman9306
    @ridwanrahaman9306 Před 2 měsíci

    Thank you sir

  • @batmandarknight5830
    @batmandarknight5830 Před 28 dny

    thanku bhai

  • @mehedihasannnnn
    @mehedihasannnnn Před 6 měsíci +1

    thank you vaiya for such a great bakcend bootcamp !!!! maja a gya

  • @mohitkansal7642
    @mohitkansal7642 Před 5 měsíci

    At 12:42 is it command prompt?. My community server is not starting.

  • @user-br3vb5mc6q
    @user-br3vb5mc6q Před 16 dny

    Thankyou sir

  • @JigsawXop
    @JigsawXop Před 6 měsíci

    Yes sir ❤

  • @moinali9874
    @moinali9874 Před měsícem +1

    Bhai sidha atlas ya compas se bhi to link leke database se connect kar sakte h na i am beginner isliye puch ra hu

  • @mukulkumar5133
    @mukulkumar5133 Před 6 měsíci +2

    good same like 3L course

  • @tarifahmed4956
    @tarifahmed4956 Před 3 měsíci

    thank you so much bhaiya

  • @hitheshpodalakuntakottige7939

    best content

  • @Gaming_pranjul
    @Gaming_pranjul Před 2 měsíci +1

    For windows, mongodb is disconnected using db.adminCommand({shutdown: 1, force: true})
    And reconnected using by running "services.msc" on cmd and start mongodb server.

    • @2719yash
      @2719yash Před 2 měsíci

      Bro can you plz. share notes

  • @minecraftcookie2929
    @minecraftcookie2929 Před 2 měsíci

    Wow when i am able to do the first entry in the db i am so happy

    • @2719yash
      @2719yash Před 2 měsíci

      Bro can you plz. share notes

    • @minecraftcookie2929
      @minecraftcookie2929 Před 2 měsíci

      @@2719yash i dont have notes. i dont make 'em i do practical hands on and if i feel something is really important i comment it out in my code

  • @Azka-vc6hd
    @Azka-vc6hd Před 2 měsíci

    excellence

  • @sharanshjha2407
    @sharanshjha2407 Před 6 měsíci

    Thanks alot bro

  • @abhishekpundir5941
    @abhishekpundir5941 Před 6 měsíci +1

    Keep going 💪❤

  • @PihulLalotra
    @PihulLalotra Před 2 měsíci

    Can you tell the extensions you are using in VsCode

  • @user-fh2wy2zv2i
    @user-fh2wy2zv2i Před 6 měsíci

    Present Sir #mongoose_schema #CRUD_operation #nodejs♥

  • @AJ-wf3wp
    @AJ-wf3wp Před 6 měsíci

    nicee.....very good

  • @Manoj_Jadhav.12
    @Manoj_Jadhav.12 Před 6 měsíci

    Maza aagaya prince bhai

  • @lohitkumarpatra6906
    @lohitkumarpatra6906 Před 6 měsíci

    sir schema mobile type number hona chaiyeh na,string likha hai

  • @EntertainmentHub0045
    @EntertainmentHub0045 Před 3 měsíci

    great video

  • @ManojDas-uf1zk
    @ManojDas-uf1zk Před 3 měsíci

    bhaiya baha pe humne as a Person model create kiya hai to people kaha se a gaya ye samjh nahi aya

  • @muhammadshoaib4837
    @muhammadshoaib4837 Před 6 měsíci

    Thanks sir g

  • @rohanvishwakarma9409
    @rohanvishwakarma9409 Před 3 měsíci

    bhaiya ajay bhaiya ke channel nhi mil rha kya hai name plz🙏🙏

  • @AliinNITW
    @AliinNITW Před 6 měsíci +2

    Can i use .then() and .catch() to handle asynchronous functions . what should i prefer async await or .then().catch()

    • @ManojDas-uf1zk
      @ManojDas-uf1zk Před 3 měsíci +1

      you should prefer async await beacuse of code readability and less code syntax

    • @amarjoshi8583
      @amarjoshi8583 Před měsícem

      you can use both but modern mern developers use async/await as per industry standards.

  • @saurabhtiwari9653
    @saurabhtiwari9653 Před 3 měsíci

    bhaiya I think in new verson of node useNewUrlParser is not necessary

  • @khushiramginnare4961
    @khushiramginnare4961 Před 6 měsíci

    Thanks bro

  • @mohitkansal7642
    @mohitkansal7642 Před 5 měsíci

    Mongodb server is not connecting ?

  • @ParvinderSingh013
    @ParvinderSingh013 Před 6 měsíci

    very nice video

  • @roteshkumar8480
    @roteshkumar8480 Před 7 dny

    #reallearning 🔥

  • @zohaircyber
    @zohaircyber Před 3 měsíci

    Dear sir, I am Zohair Faruqi from Karachi, Pakistan I would like to say that your course is very helpful for those whose beginners.
    Most of the students are overseas , kindly to give free link for your foreigner students , they need notes too , for follow your course.
    Because foreigners have not any payment method. Kindly understand most of the students problems.
    Thanks
    Zohair Faruqi

  • @SahilKumar-xz1xs
    @SahilKumar-xz1xs Před měsícem

    where can i get these notes

  • @user-tb5ew5sq5g
    @user-tb5ew5sq5g Před 2 měsíci

    thanks

  • @factsmotivation7728
    @factsmotivation7728 Před 2 měsíci

    how to disconnect the mongodb in window any body answer please

  • @props.Expert
    @props.Expert Před 8 hodinami +1

    Keep It Up Good Work ❤

  • @parthtakale4308
    @parthtakale4308 Před 2 měsíci +3

    sir can you please provide the notes

  • @ADARSHKUMAR-pu9sn
    @ADARSHKUMAR-pu9sn Před měsícem

    Bhaiya mongoose ko Nodejs server se connect karne pe error aa raha hai please help me

  • @SilentGaming-satisfaction

    Bhaiya Love from Nepal❤ Your teaching style is awesome
    Bhaiya I have one doubt
    In GET method, menu Ka port 3001 mey hogaya but 3000 mey he menu +person Ka nahe hora hey why?

  • @jayminprajapati3178
    @jayminprajapati3178 Před 3 měsíci

    on event not working, please solution

  • @muhammadshoaib4837
    @muhammadshoaib4837 Před 6 měsíci

    🔥🔥🔥🔥

  • @somyajain1683
    @somyajain1683 Před 12 dny

    Bhaiya ye pluralization ka error solve nhi ho rha pls help 2 din se lagi hu ise solve krne me lekin nhi ho rha or ye connection wala message bhi aa rha terminal per

  • @subhadeepkhan5470
    @subhadeepkhan5470 Před 4 měsíci

    hotels kaha pe define kiya tha?

  • @AkashKumar-ly1pb
    @AkashKumar-ly1pb Před 2 dny

    help.. mre m mongoose connected hi n aa rha h server is running tk aa rha h uske baad error aa rha h

  • @pumpkin2228
    @pumpkin2228 Před 6 měsíci

    🔥🔥🔥🔥🔥🔥

  • @piyushgupta7259
    @piyushgupta7259 Před 4 měsíci

    Hii Bhaiya ,
    Database me people name ka collection kaise bana humne toh use code me kahi mention nahi kiya tha ...??
    please reply

  • @utpaltripathi9577
    @utpaltripathi9577 Před 5 měsíci

    Simplified explanation

  • @AdityaKumar-ky8eo
    @AdityaKumar-ky8eo Před 3 měsíci

    run hi nahi ho pa rha h code
    error while connecting to the database

  • @Abhay14
    @Abhay14 Před 4 měsíci

    bhaiya async await to samajh me aagya
    const savedPerson = await newPerson.save()
    but ye .save() kya h isse apne aap save ho jata h kya ?

  • @mehedihasannnnn
    @mehedihasannnnn Před 6 měsíci

    vaiya sab to thik hei but database me people name se kyu aya...hum tp person naam se banaya tha module...

  • @ashishmaisachinanand9599
    @ashishmaisachinanand9599 Před 4 měsíci

    Ajay bhaiya ka channel kaun sa hai sir ji?

  • @JigsawXop
    @JigsawXop Před 6 měsíci

    sir for pratice notes problem can we get soln? if we hv doubt

  • @haris7247
    @haris7247 Před 4 měsíci +2

    my server.js file is throwing errors and not getting connected to mongoDB @11:42. On terminal it shows server is listening on port 3000 and then throws an error and nodemon gets crashed.

  • @sakshirathod4158
    @sakshirathod4158 Před 3 měsíci

    Please create frontend(react.js) playlist it would be very helpful for us.

  • @reeshusinghvlogs123
    @reeshusinghvlogs123 Před měsícem

    Sir server toh connect ho ja raha hai but database nahi ho raha node js se connect , db.on mai error aa raha hai ,,,,, plssssssss helpppp