How to Connect Node.js App to MongoDB | Node.js & MongoDB Tutorial

Поділитися
Вставка
  • Опубліковано 14 тра 2022
  • Hey guys, welcome back! In this video, I will be showing you how you can connect your Node.js application to MongoDB. I'll be walking you through signing up, creating a cluster, and connecting your application to the cluster.
    If you don't know what MongoDB is, MongoDB is a document-oriented database that stores data in JSON-like documents with dynamic schemas. It is most commonly used in the back-end for web applications and is the leading NoSQL database and can be used in many different ways, from a simple key-value store to a complex full-text search engine.
    If you don't know what Node.js is, Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
    My Website: arpanneupane.com
    My GitHub: github.com/arpanneupane19
    Official Express Documentation: expressjs.com/
    Official Mongoose Documentation: mongoosejs.com/docs/guide.html
    Code in this video: github.com/arpanneupane19/Nod...
    My Programming Gear :
    Keyboard: amzn.to/42vXkxh
    Laptop: amzn.to/3CkAP3W
    Laptop Stand: amzn.to/3X116Oi
    Desk: amzn.to/43wmIEt
    Monitor: amzn.to/42BAaFH
    Monitor Arm: amzn.to/3NR0APS
    Chair: amzn.to/42vvKAn
    Desk Mat/Mousepad: amzn.to/43AhKqj
    Microphone: amzn.to/45RuQ43
    Headphones: amzn.to/445sf4R
    #LearnToCode // #Node // #MongoDB // #Web
  • Наука та технологія

КОМЕНТАРІ • 85

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

    I struggled with this for hours, watching different tutorials but this was so straight to the point. Thanks.

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

    Finally, someone who writes an accurate title.
    Nice and efficient. Great video!

  • @milesthomas3317
    @milesthomas3317 2 роки тому +14

    Very easy to follow along, and no time wasted! Great tutorial as always!

  • @traezeeofor
    @traezeeofor 6 місяців тому +1

    Thanks for this man. 2nd video of yours I'm watching. The other was a beginner nodejs/Express project. This is my first MongoDB project.
    Keep up the good work!

  • @joelsjunk239
    @joelsjunk239 Рік тому +2

    This helped me a ton after having many headaches trying to connect to mongodb by myself! Thanks!

  • @dushyantyadav7740
    @dushyantyadav7740 Рік тому +1

    Such a simple and Perfect tutorial which I wanted

  • @kwanelekhumalo
    @kwanelekhumalo Рік тому +6

    Took something that most people complicated and then you simplified it. Not too much explaining that's unnecessary. Great video on this!!

    • @ArpanNeupaneProductions
      @ArpanNeupaneProductions  Рік тому +1

      Thanks!!

    • @peterkabiru5144
      @peterkabiru5144 Рік тому

      very true. I followed along and the database connected Asap! like..I wasn't believing it ..after a watching many videos with failed attempt.

  • @29snapdragons
    @29snapdragons Рік тому

    Thanks - easy steps to follow!

  • @ngouendgerard4114
    @ngouendgerard4114 Рік тому +1

    Very grateful Arpane you split part to be well understood by beginners

  • @koayzhengliang6818
    @koayzhengliang6818 Рік тому

    Great tutorial video, thanks!

  • @hj1916
    @hj1916 Рік тому

    You really nailed it! Thank you~!!!!

  • @liloscar121699
    @liloscar121699 Рік тому

    most helpful video I've seen

  • @rotr8196
    @rotr8196 Рік тому +1

    great tutorial, thanks

  • @jedryan5061
    @jedryan5061 Рік тому

    I love you man. Make my life so much easier

  • @darjijenish
    @darjijenish Рік тому

    Thanks Bruh.. Helps me a lot

  • @chauloannguyen1954
    @chauloannguyen1954 Рік тому

    very helpful. thank you

  • @amiralikarimi2449
    @amiralikarimi2449 Рік тому

    thank it was very helpful

  • @shiva_gaming8122
    @shiva_gaming8122 Рік тому

    thanks bro it helps me lot

  • @jm_studio4908
    @jm_studio4908 Рік тому +1

    Thank you a lot Arpan^^ , great job !

  • @19cornholio90
    @19cornholio90 Рік тому

    Great vid!

  • @m.c1299
    @m.c1299 Рік тому +2

    Thank you for the video idk why but this is the only video that worked for me ? Every other time it wouldn't connect? Thanks again!

  • @blottolotto7648
    @blottolotto7648 Рік тому

    perfect. thanks!

  • @rakibhossianraju941
    @rakibhossianraju941 Рік тому +1

    Thank You soo much for making this video it is really helpful

  • @himo5666
    @himo5666 Рік тому

    Would it be any different if you installed mongodb locally on your computer and used it as an application rather than through the website (cloud)?

  • @Quadropheniaspain
    @Quadropheniaspain Рік тому +1

    contenido extenso y muy útil caballero. enhorabuena y gracias 👌

  • @tulioerna6922
    @tulioerna6922 Рік тому +1

    is it mandatory to create an account? What If I just want to test my stuff locally using the ecompass from mongo and my node setup?

  • @MohamedReda-yi7xd
    @MohamedReda-yi7xd Рік тому +1

    thank you, it worked!

  • @putinsarmy6861
    @putinsarmy6861 Рік тому +1

    Even the beast approves

  • @alejandro93102
    @alejandro93102 11 місяців тому

    Best Video Ever!

  • @tarang5757
    @tarang5757 Рік тому +1

    Hey there what is the visual studio code theme?

  • @hend9745
    @hend9745 День тому

    thank you!

  • @aghazadajamil5628
    @aghazadajamil5628 Рік тому +1

    bro what is your vscode theme and font colors?

  • @underbedmonstersmusic
    @underbedmonstersmusic Рік тому

    great video

  • @jaop5281
    @jaop5281 11 місяців тому

    thank you so much

  • @eraybaydemir8240
    @eraybaydemir8240 Рік тому

    THANK YOU

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

    Very very Nice tutorial

  • @mr.x5131
    @mr.x5131 Рік тому

    Bro did u use any rest Api here..?

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

    life saver

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

    inside one connection if I want to connect to a specific database then how am I supposed to do it??

  • @mohammedelmasry648
    @mohammedelmasry648 Рік тому

    thanks

  • @baaserosman8546
    @baaserosman8546 2 роки тому +1

    Perfect

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

    perfecto :)

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

    Please how do I know the terminal to use
    I'm quite confused on that part

  • @pietrorodrigues3008
    @pietrorodrigues3008 Рік тому

    Thank you, i'm connected to my Database! I tried a few times and it didnt work

  • @ankitpanda1860
    @ankitpanda1860 2 роки тому +1

    While connecting to cluster why can't I see myFirstDatabase option in the connection string?

    • @ArpanNeupaneProductions
      @ArpanNeupaneProductions  2 роки тому

      Do you mean the connection string in the video or the connecting string that's shown on the webpage?

    • @Xxxsorrow
      @Xxxsorrow Рік тому

      Yeah it's different for me, too. There is no database name in my string when I copy it from the website.

    • @ArpanNeupaneProductions
      @ArpanNeupaneProductions  Рік тому

      @@Xxxsorrow What is the name that you chose for the database?

  • @loyal_believers8707
    @loyal_believers8707 Рік тому

    how can we develop a log in registration form and authenticate it ?

    • @ArpanNeupaneProductions
      @ArpanNeupaneProductions  Рік тому

      If you're using Node and another frontend library (React, Angular, etc), you can use JWT authentication. If you're just using Node and HTML, you can use sessions.

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

    good

  • @korbol1847
    @korbol1847 Рік тому +1

    What's your keyboard and vs code theme? 😅

    • @ArpanNeupaneProductions
      @ArpanNeupaneProductions  Рік тому

      My keyboard is a Keychron K2 V2 Wireless Mechanical Keyboard and my color theme is the Panda Theme from VSCode Extensions.

  • @devngecu
    @devngecu Рік тому

    am getting an error "URI malformed, cannot be parsed".................Please help

  • @vijaychandupasupuleti1601
    @vijaychandupasupuleti1601 Рік тому

    Error connecting to the database: MongoServerError: bad auth : authentication failed
    at Connection.onMessage (C:\Users\vijay.chandhu\Desktop
    ew-mern\mern-login-system-2022\server
    ode_modules\mongodb\lib\cmap\connection.js:207:30)
    at MessageStream. (C:\Users\v

  • @heshamelmesalmy5950
    @heshamelmesalmy5950 16 днів тому

    please help ..... error :
    SyntaxError: Unexpected token '.'
    ←[90m at Object.compileFunction (vm.js:344:18)←[39m
    ←[90m at wrapSafe (internal/modules/cjs/loader.js:1048:15)←[39m
    ←[90m at Module._compile (internal/modules/cjs/loader.js:1082:27)←[39m
    ←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1138:10)←[39m
    ←[90m at Module.load (internal/modules/cjs/loader.js:982:32)←[39m
    ←[90m at Function.Module._load (internal/modules/cjs/loader.js:875:14)←[39m
    ←[90m at Module.require (internal/modules/cjs/loader.js:1022:19)←[39m
    ←[90m at require (internal/modules/cjs/helpers.js:72:18)←[39m
    at Object. (D:\Programming\Node JS\code\server
    ode_modules\←[4mmongodb←[24m\lib\index.js:6:17)
    ←[90m at Module._compile (internal/modules/cjs/loader.js:1118:30)←[39m
    PS D:\Programming\Node JS\code\server>
    my steps is :
    const express = require("express");
    const mongoose = require("mongoose");
    const app = express();
    const uri =
    "mongodb+srv://localhost:27017";
    async function connect() {
    try {
    await mongoose.connect(uri);
    console.log("Connected to MongoDB");
    } catch (error) {
    console.error(error);
    }
    }
    connect();
    app.listen(3000, () => {
    console.log("Server started on port 3000");
    });

  • @flaviopalomba6577
    @flaviopalomba6577 Рік тому

    comm sfaccimm t'am vita mij thank you so much

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

      O sfacimm sono felice che tu ce l'abbia fatta

  • @MieMie-zp1lo
    @MieMie-zp1lo Рік тому

    Hello, I can't connect with mongodb and nodejs . Please help me!

    • @aku9018
      @aku9018 Рік тому

      Connect chaetharno

  • @wiselychosen7454
    @wiselychosen7454 2 роки тому

    how long have you been coding?

    • @ArpanNeupaneProductions
      @ArpanNeupaneProductions  2 роки тому

      I believe for about 2.5 years.

    • @aku9018
      @aku9018 Рік тому

      @@ArpanNeupaneProductions connecting between mongobd and node il connect function wrk chaeyunillaalo y ? Ariyamo?

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

    I guess the interface is different now, could you update

  • @sadiqdaniel
    @sadiqdaniel Рік тому +2

    It's important not to use a public network

  • @johnrhunor4383
    @johnrhunor4383 Рік тому +3

    if you get the DeprecationWarning that means you're working in the latest mongodbversion like me so what you do is in the line inside the async function
    async function connect(){
    try{
    mongoose.set('strictQuery', true);
    await mongoose.connect(uri);
    // await mongoose.connect(uri);
    console.log("connected to mongoDB");
    }catch(error){
    console.error(error);
    }
    }
    connect();

  • @kakerake6018
    @kakerake6018 Рік тому

    7:54 what? there's a part missing here

  • @ranshikamihiran9215
    @ranshikamihiran9215 Рік тому

    🤙

  • @vaneer1335
    @vaneer1335 Рік тому

    a single frame revealed your ip address

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

    Why are you afraid of people seeing your IP... -_-

  • @inam.ur.rehmannami9756
    @inam.ur.rehmannami9756 Рік тому

    Kia aap ko urdu ni haati