Connecting NodeJS with MongoDB | Mongoose + Express

Поделиться
HTML-код
  • Опубликовано: 1 янв 2025

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

  • @亗Pawar
    @亗Pawar 6 месяцев назад +26

    Please try to make/create separate code for each ep if possible. Bcz it is difficult to connect to your video in-btn. Means I'm watching this vdo directly of your series and it is difficult to connect with your explanation bcz you are doing changes in your code which is written in previous videos.
    No doubt Ur explanation is very good and I'm very excited to learn from U.

    • @tusharsingh1915
      @tusharsingh1915 5 месяцев назад +1

      Instead, right now you can create copy of previous videos:)

  • @Skieee-r3f
    @Skieee-r3f Месяц назад +1

    u kn what i have watched 2 series from 2 courses like watched some initial videos but they made it so much complicated from the initial itself but sir u keep it really simple and much understandable
    thank god i found this channel else i would be still searching for backend series and wasting my time
    thank u so much piyush❤ keeping growing!

  • @HussnainAhmad-b8e
    @HussnainAhmad-b8e 4 месяца назад +3

    Literally, your method of teaching is so good and excellent. No doubt in saying that you are better than codewithharry and many others you tubers.
    Hats off to your hard work and big fan of your teaching style :)

  • @theannonymous1430
    @theannonymous1430 Месяц назад +1

    Best NodeJS series on the RUclips.
    Huge Respect Man ❤

  • @SuplavPandey
    @SuplavPandey 3 месяца назад +4

    schema is the blueprint(or structure) of collection->it is like class in oop
    but model provide methords to actually intract with database->it it like object in oop as the instance of schema

  • @yunuszanzibarwala8344
    @yunuszanzibarwala8344 29 дней назад

    I have been following this tutorial from beginning. I love learning and the way you teach that amazing. the way you speak slowly it helps digest each and every word. Thanks a lot :)

  • @RohitKumar-dy2gc
    @RohitKumar-dy2gc 10 месяцев назад +6

    so much new things i am learning easily from these videos✨✨

  • @iamakashkumarram
    @iamakashkumarram Год назад +4

    Bohoti tagri explanation ha bhaiya maja a gaya 🔥🔥

  • @dhruvmalik8052
    @dhruvmalik8052 Месяц назад

    Fantastic explanation! Your video breaks down complex concepts into easy-to-understand steps. The visuals and examples are spot on, making learning enjoyable and engaging. Keep up the great work-this is the kind of content that truly helps learners succeed!

  • @zooheb529
    @zooheb529 3 месяца назад

    Man i love the way of your teaching. Paid course mein itna detail mein koyi nahi samjhaya ❤❤❤❤❤

  • @bhawnachowdhary5466
    @bhawnachowdhary5466 8 месяцев назад +3

    Amazing series.. Sir you make everything so simple.. Thanks a lot🙏🙏

  • @mma-dost
    @mma-dost Год назад +3

    Great videos bhaiya ❤❤🔥🔥🔥🔥💪💪

  • @ibrahimali7549
    @ibrahimali7549 Месяц назад

    Thanks bro! I was stuck for too long due to a small mistake! You helped me resolve it.

  • @RahulKumar-ed9vw
    @RahulKumar-ed9vw 4 месяца назад +1

    Best Series ever on backend.

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

    God Level Explaining !!!!!!!!!!!!

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

    great way of explanation 🙏

  • @CricketHighlights-nt7nn
    @CricketHighlights-nt7nn Год назад +1

    yes, ur tutorial solve my problems...thanks a lot boss

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

    Thanks you, with that video is easy learning mongo and node express

  • @VishalMishraYouTube
    @VishalMishraYouTube Год назад +5

    bro, you've been sent by God 🙏

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

      😅

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

      ​@@semicolon6499 ;

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

      Isn't everyone sent by God lmao?

    • @Deepak-gi8mp
      @Deepak-gi8mp 4 месяца назад +1

      Bhai agar aapka full stack ho gya ho toh kuch tips doge ?? Mene js me project km bnaiye aur ye playlist follow kr raha hu.. koi dikkat toh ni hogi aapne jo difficulties face kri aur unko kaise handle kra bata sakte ho??

  • @govtrecruitmentalert4890
    @govtrecruitmentalert4890 5 месяцев назад

    Very nice explanation 👌

  • @namannema3349
    @namannema3349 8 месяцев назад +1

    nice explanation bhaiya

  • @sahil-j3z8w
    @sahil-j3z8w Год назад +2

    appreciated 💯... sir
    Also make tutorial on nodejs framework(nestJs).

  • @chiraglimbachiya2688
    @chiraglimbachiya2688 5 месяцев назад

    Nice Bro, very informative tutorial.

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

    thanks a lot piyush sir great teacher and mentor

  • @Ari-pq4db
    @Ari-pq4db 8 месяцев назад

    Thank you very much, keep them coming ❤

  • @iamakashkumarram
    @iamakashkumarram Год назад +5

    Bhaiya e series ke bad ReactJS ka advance topic bhi cover karwana like Data Handling, Reconciliation,Lazy Loading,Portals,Theming, Patterns,Anti-Patterns, Testing esab topic please cover karwaiyega.

  • @lovelymusic3549
    @lovelymusic3549 Год назад +4

    Sir will you upload a complete course of mern stack?

  • @poojaganvir5631
    @poojaganvir5631 11 месяцев назад

    Thank you so much. You have explained very well!😊

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

    amazing 🔥

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

    Great explanation.

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

    Great video 👍

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

    The best ❤❤

  • @kapadiyajay
    @kapadiyajay 2 месяца назад +1

    sir i am writing these code in the mt pc but here you have written
    const result = await User.create({
    })
    but await is giving a error but you run successfully please explain

  • @abhisheknavgan6829
    @abhisheknavgan6829 11 месяцев назад +4

    5:19 gender should be a enum but in 2024 I think String would be better 😂😂😂😂

  • @warrior_pk
    @warrior_pk Год назад +2

    I am not able to install mongodb and mongosh on my ubuntu 22.10. I searched a lot but there were no mention of ubuntu 22.10 or 22.04lts on even offical docs.
    So i am using atlas and compass.
    Are you going to teach these ?

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

      To install MongoDB on Ubuntu 22.10, you can follow these steps:
      1. Import the MongoDB public GPG key:
      sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 4B7C549A058F8B6B
      2. Create a list file for MongoDB:
      echo "deb [ arch=amd64,arm64 ] repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
      3. Reload the local package database:
      sudo apt-get update
      4. Install the MongoDB package:
      sudo apt-get install -y mongodb-org
      5. Start MongoDB:
      sudo systemctl start mongod
      6. Verify that MongoDB has started successfully:
      sudo systemctl status mongod
      7. Download the mongosh package from the MongoDB website.
      curl -LJO github.com/mongodb/mongosh/releases/download/v1.0.0/mongosh-1.0.0-linux-x86_64.deb
      8. Install the package using dpkg
      sudo dpkg -i mongosh-1.0.0-linux-x86_64.deb
      Then just run mongosh

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

      @@piyushgargdev thank u, worked for me..

  • @awesomeguy6427
    @awesomeguy6427 Год назад +2

    Hi Piyush please make a project based on this series

  • @AYUSHKUMAR-xj4wc
    @AYUSHKUMAR-xj4wc 11 месяцев назад

    Awesome❤❤❤

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

    great explanation

  • @AnabGul-g8j
    @AnabGul-g8j 9 месяцев назад

    thanks alot finally got it how it works

  • @vikashbisht6097
    @vikashbisht6097 10 месяцев назад +2

    hello bhaiya car rental app bna rha hu lakin mongodb nhi aata h but im trying to make a database but not able to do can you help please

    • @hjajajheg3g
      @hjajajheg3g 6 месяцев назад +2

      hn bhai 4 mahine hogay... bangya?

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

      Aur Bhai Fir 6 mahine hogay kuch bana kya?

  • @Aitool-r3q
    @Aitool-r3q 11 месяцев назад

    Awesome 👍

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

    if you could tell why i have to use async await and not genreak func, it would be great

  • @ramendrasoni3368
    @ramendrasoni3368 7 месяцев назад +1

    this request takes too long to process it is timed out by the server in nodejs mongodb
    Mai shared hosting use kar Raha hu jisme Nodejs 20.3.1 hai aur Maine apni Nodejs website ko version 21 par banaya hai... Kya ye MongoDB connection string ki problem hai...?? Ye kaun si problem hai aur kaise sahi Karu... Please guide me ..

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

    Awesome video

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

    Hi Piyush, we really appreciate the efforts you've put into creating these awesome tutorials. In this particular video, it would be helpful if you've also shared solution to two problems:
    1) POST request with duplicate email crashes the server, how do we handle error here?
    Since we've defined Mongoose schema with email: {required: true}, it throws an error and the server gets crashed if we put in the same/duplicate email id again -> as shown in your video as well. But what is the solution for this?
    Also,
    2) We are using MongoDB id creation value to find the database items. If we create our own custom id, ho do we fetch the data then? I am sure findById, findByIdandUpdate, findByIdandDelete methods won't work in this scenario. Using the Mongoose created ID is too long and not feasible to use.

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

      use try and catch method it will handle the server crash case

    • @vivekraiyani63
      @vivekraiyani63 11 месяцев назад

      same issue bro

    • @sureshbhatt363
      @sureshbhatt363 11 месяцев назад

      @@vivekraiyani63 using Try and Catch method solved the problem

    • @Chaudharyhammad
      @Chaudharyhammad 11 месяцев назад

      1st check for email if it already exists then throw and error message and if not then proceeds further

    • @SwatejTech
      @SwatejTech 11 месяцев назад

      Add a middleware to check if the user already exists before proceeding to the insertion.

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

    Is there any github repo for this code, so that i can have starter code and code along this tutorial ?

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

    Which extension do you use for mongoose, cause im not getting the auto suggestion. Thanks

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

    Hey...Piyush will make some videos over "MongoDB aggregation pipeline" topic 😃😃😃😃👋👋👋👋

  • @techtaleswithshivam
    @techtaleswithshivam Год назад +2

    Can you please share the source-code for this program.

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

    woww thanks bhaiya

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

    Hello Piyush,
    Nice tutorials, But I couldn't get intellisense for mongo CRUD method, how to get that? Pls help

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

    Here we are using blocking code while working with database. I assume it's ok for small application but when data becomes very large who we will handle that ? Onw way might be to use promises and on then we can send response. is there any other way ?

  • @banothutharun2743
    @banothutharun2743 3 месяца назад

    Master 🎉

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

    Thanks a lot man.. I was using this but putting localhost and 27017 not giving ip.. going to different channels all doing same getting connected but you did copy paste and its help thanks..

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

      Kaise hua Bhai Mera nhi ho rha

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

      @@bineetjha2268 use shell ip!! as shown in the video very easily u will be connected

  • @saxenabhavesh6941
    @saxenabhavesh6941 Год назад +20

    Your explanation is good but the code looks so bad , use different code for each video so we can understand it better manner ..

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

      Tare to karvu nahi.. bija kare aene to krvada. Bencbod

    • @Deepak-gi8mp
      @Deepak-gi8mp 4 месяца назад +3

      Bhai agar aapka full stack ho gya ho toh kuch tips doge ?? Mene js me project km bnaiye aur ye playlist follow kr raha hu.. koi dikkat toh ni hogi aapne jo difficulties face kri aur unko kaise handle kra bata sakte ho??

    • @saxenabhavesh6941
      @saxenabhavesh6941 4 месяца назад

      @@Deepak-gi8mp bhai js kr project jayda matter nahi krte 1-2 project bhi bahut hai and agar front-end complete ho gya hoto ek project react mai banao like accha portfolio and e-commerce website using redux toolkit or redux and agar aapka backend ho gya hoto uska project banao accha or agar backed sikhna hai to chai or code pr video dekh lo

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

    hii piyush ... i m getting this error [nodemon] app crashed - waiting for file changes before starting...how to resolve this please suggest

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

      Same... Do u got the solution?

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

      @@pranjalmaurya3832 nhh bhai didnt got the solution

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

      Yes I am also getting this

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

      @@nirmalchouhan3112 stop the nodemon using ctrl+c and read what error u got if i am not wrong ur mongod is not running in terminal so use mongod in terminal and then open another terminal and run mongosh in it and try restart ur nodemon file

  • @vanshikasoni6950
    @vanshikasoni6950 3 месяца назад

    mongosh is not running on my terminal, what to do sir?

  • @govindkrishnamishra-km8tj
    @govindkrishnamishra-km8tj Год назад

    great video

  • @santoshbhujbal5650
    @santoshbhujbal5650 5 месяцев назад

    Sir current mongo db version are very different process for windows and connectivity 😮😮😮

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

    bhaiya mongodb connect karne ke baad mongodbconnected likha nhi aarha aur ulta mongoose server selection error aa rha hai topology vaguer se related, please help!

  • @user--84
    @user--84 Год назад +2

    Sir you should also give code if you give code then it will be very easy for us for coding

  • @shubhamdhiman9841
    @shubhamdhiman9841 3 месяца назад

    @everyone please if anyone had complete code till this video please share it in comment..

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

    Sir humara status 400 bad request aara hai 201 ke jaghe per
    Kya kare??

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

      same error get 400 inplace of 201. Please resolve the error

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

      same error how to resolve this issue plz sir reply

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

    Sir I want to ask here that how can I connect mongoDb if I am doing it for the website of my client, because here we are saving data in our local machine but what if I want data to be saved in my clients computer. Please give me solution.

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

      You need to use cloud services then. It's just about having a machine online that runs on cloud.

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

    MongoParseError: Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"
    I'm facing this error while connecting mongodb
    Can you help me ??

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

      Can you paste your code, or mongodb url that you are trying to use?

    • @eswarsai5163
      @eswarsai5163 8 месяцев назад

      do not copy full url in the mongosh terminal just we have to copy some part, check it again

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

    Thank you🙏

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

    mongo db ka interface to dikha deta, how it is lookd like , i unable to add data manually in mongo db

  • @nishu20501
    @nishu20501 8 месяцев назад

    finally samajh aaya ab jakar

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

    Bhai mongosh keyword work nahi kar Raha hai in windows

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

    how to install mongodb for windows . and after installation of msi file of mongodb how to run mongodb in command prompt ? pls help

    • @anandshete9170
      @anandshete9170 11 месяцев назад

      search yt please bro there are tons of vids out there!

  • @MuhammadAdeel-wn9zq
    @MuhammadAdeel-wn9zq Год назад

    Appreciated

  • @BhagatBhutale..
    @BhagatBhutale.. Месяц назад

    Video useful

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

    bro wo depricated wala error kaise hataye please reply

  • @AHMADSOHAIL-s7m
    @AHMADSOHAIL-s7m 5 месяцев назад

    such a nic video

  • @ErrorEagle-z6r
    @ErrorEagle-z6r Месяц назад

    Thanku sir

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

    Thanks bro

  • @HarpreetSingh-pi1ki
    @HarpreetSingh-pi1ki 9 месяцев назад

    Thankyou sir

  • @Harshitha-c6h
    @Harshitha-c6h Год назад

    can we get the codebase or github link for this

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

      Why do you need that? Are the tutorials not enough to make you understand everything? If not, you need to really work on the basics first because this is indeed a very basic video

  • @Dhruv-gl4sv
    @Dhruv-gl4sv Год назад

    Are required: true and unique: true not valid now??

    • @Deepak-gi8mp
      @Deepak-gi8mp 4 месяца назад +1

      Bhai agar aapka full stack ho gya ho toh kuch tips doge ?? Mene js me project km bnaiye aur ye playlist follow kr raha hu.. koi dikkat toh ni hogi aapne jo difficulties face kri aur unko kaise handle kra bata sakte ho??

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

    Sit, I am trying to create API for registered users but i am getting error-
    Error registering user: MongoServerError: E11000 duplicate key error collection: property.users index: gender_1 dup key: { gender: "Female" }
    at InsertOneOperation.execute (D:\sanjay
    eact\sidhu-mearn\server
    ode_modules\mongodb\lib\operations\insert.js:51:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async executeOperation (D:\sanjay
    eact\sidhu-mearn\server
    ode_modules\mongodb\lib\operations\execute_operation.js:136:16)
    at async Collection.insertOne (D:\sanjay
    eact\sidhu-mearn\server
    ode_modules\mongodb\lib\collection.js:155:16) {
    errorResponse: {
    index: 0,
    code: 11000,
    errmsg: 'E11000 duplicate key error collection: property.users index: gender_1 dup key: { gender: "Female" }',
    keyPattern: { gender: 1 },
    keyValue: { gender: 'Female' }
    },
    index: 0,
    code: 11000,
    keyPattern: { gender: 1 },
    keyValue: { gender: 'Female' },
    [Symbol(errorLabels)]: Set(0) {}
    }
    Sir, phone, email should not be same but user name, Hobbies, gender, Image could be same.... Kindly guide me... I am beginner

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

    Are bhai findById() method to chal hi nhi Rahi hai

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

    Thanks

  • @sidanshu012
    @sidanshu012 4 месяца назад

    10:34 male kyu female hi rehne dete 😢😂

  • @Kabirrsaini07
    @Kabirrsaini07 8 месяцев назад

    sir can you also give us the code...it would be helpful to understand more easily then

  • @NinjaDevPlays
    @NinjaDevPlays 8 месяцев назад

    maja aa gaya

  • @entertainment_only4342
    @entertainment_only4342 3 месяца назад

    siurce code kha h

  • @shubhamdhiman9841
    @shubhamdhiman9841 3 месяца назад

    Can anyone had complete code tilll this video??

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

    2:30

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

    Vid - 19✅

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

    8:07

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

    0:25

  • @ScoreboardLives
    @ScoreboardLives 5 месяцев назад +1

    source code bhi de diya karo 🙃

  • @montyk.151
    @montyk.151 5 месяцев назад

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

    bro sukriya bhagwaan acchi bahu de

  • @arjunyadav-kt5jr
    @arjunyadav-kt5jr 10 месяцев назад

    plural Tense!

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

    code for patch method
    patch(async(req,res)=>{
    //edit an existing user
    const id = req.params.id;
    const body = req.body;
    try {
    const user = await User.findById(id);
    if (!user) {
    return res.status(404).json({ status: 'Error', message: 'User not found' });
    }
    // Check for changed properties and update only those that exist in the request body
    Object.keys(body).forEach((key) => {
    if (user[key] !== undefined) {
    user[key] = body[key];
    }
    });
    await user.save();
    return res.json({ status: 'Success', updatedUser: user });
    } catch (err) {
    return res.status(500).json({ status: 'Error', message: 'Internal server error' })}
    })

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

    done

  • @shi-nee7966
    @shi-nee7966 Год назад

    im crying

  • @SuplavPandey
    @SuplavPandey 3 месяца назад

    hi

  • @ashutoshbind8068
    @ashutoshbind8068 4 месяца назад

    dsd