Intro to MongoDB and Mongoose | Node.js Tutorials for Beginners

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

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

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

    I bet.
    This is most precious mongodb content in the entire universe

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

    you're from another planet bro 💯😊what you're doing now it's perfect, keep going and I'm sharing your channel even in my WhatsApp story daily 😊 I'm here to help you whenever you need 🤜🤛

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

      Thank you so much Abdullah! I appreciate you sharing. 💯🚀

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

      @@DaveGrayTeachesCode you're welcome dave! 🤜🤛👩‍💻Keep going 🤗

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

      Thats amazing information about Mongoose: ruclips.net/video/ppdhG0TiLiw/видео.html

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

    "testing123... kinda like a mic check". dave you are a backend rockstar

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

    @Dave Gray
    Thank you for making this tutorial simple enough for us beginner to understand better!!!
    Just what i need it!

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

    Your explanation is amazing! I wish you were proffesor in my college...

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

    An excellent tutorial like all the others. Thanks, Dave. Thanks for the advice: "Keep striving for progress over perfection". This is the key. What do you think about doing a tutorial about NextJS?

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

      You're welcome! NextJS is a great idea and something I definitely plan to cover 💯🚀

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

    This was perfect! Straight forward, easy to follow and succeeded with a connection. Thanks!!

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

    your explanations are just perfect Dave , I would have liked to know your channel before all the courses purchased here and there ... I really expect a ton of videos from you ( PHP , Symfony , Sass please ...etc ) . Thank you Dave :)

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

    You've read my mind! This is exactly what I was expecting right after Node/Express. Great!

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  3 года назад +4

      Glad to help! I wanted to cover the full MERN stack when combining this Node.js series with my React tutorials. 🚀

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

      @@DaveGrayTeachesCode, it would fantastic if in the end, you can build MERN projects. Using all of the knowledge acquired.

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

      @@lavitzwind6709 yes, this series delivers the backend of the MERN stack (Node, Express, Mongo) so when combined with my React tutorials, full MERN projects may be completed. I'll be posting MERN projects, too.

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

    Have you got videos of you setting up this project? I see everything is well documented and organized. I’d like to be able to follow along to better understand how you decide to write your middleware. What you choose to log. Why the credential check is before CORS etc.

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

      Hi Sasha, good questions! I do not have videos setting up the project. I just make the tutorials. To answer the specifics you mentioned: I write the middleware based on need only. I only log things during development to see the values myself or during a tutorial to show as an example. The credential middleware is referencing the 'Access-Control-Allow-Credentials' which is sent back because browsers will send a preflight OPTIONS request before sending the intended POST (or other) request from the frontend. If it doesn't pass preflight, it will block the intended request. More on that on MDN here (look for 'Preflighted Request" subheading): developer.mozilla.org/en-US/docs/Web/HTTP/CORS

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

      @@DaveGrayTeachesCode thanks! I actually did find what I was looking for since commenting. Turns out this video is part of a larger Node playlist, and I'm slowly making my way through those. Thanks! I subbed.

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

    Thank you, Dave! Please make video series about Angular :)

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

    Best tutorial ever!

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

    super we need advanced tutorial for same topic

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

    Tank you for this video I really needed this! You did an amazing job!

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

    Professor Severus Snape

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

    Those are great tutorials thanks for sharing !!

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

    Thank you so much for the lessons I've really learned a lot

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

    Very well explain! it has been very useful!

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

    You're my hero Dave

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

    You can't throw out normalisation without consequences in a no SQL database any more than you can in SQL.
    Sure SQL database designer stress it more, but it is entirely up to whoever creates the schema to ensure there's no room for redundancies (except for keys) in that schema. More about that later.
    But there's nothing _in_ SQL that forces you to normalise your schema and hence data. You can store redundant data in SQL as easily as MongoDB or indeed paper files.
    In any case the effect of _not_ normalising is the same: potentially redundant data that becomes contradictory and therefore wrong when you edit it.
    Because you forgot where you put all the copies and so when you did an one or more didn't get updated properly because you forgot about it or accidentally used different data for one.
    Even with psuedo SQL you can normalise to third normal form and be fairly sure this just can't happen.
    Unless for instance you did
    misidentified what needs to be 'an entity', eg, you did something like hard bake all address details into your person table, because you were convinced you'd never, ever, need to consider an address as something separate from an individual person. Which is clearly not true, because people change their address all the time...
    A "proper" SQL implementation will give you ways of ensuring the rules YOU put in are followed, but there's nothing forcing you to put them in in the first place, and indeed in many so called SQL implementations such as MySQL for instance much of this rule enforcement is either missing or turned off by default. Except that pretty much always you have to make a special arrangement to store than one thing in every intersection of row and column, and usually all rows in a table must have the same number and type of columns.
    Which indeed goes a long way to explain why MySQL is considered so fast compared to other RDBMSs (relational database management systems).
    Purists might argue it's because it dosen't qualify as an RDBMS, instead it's just a store of tables with an interpreter that allows SQL style queries.
    That brings me to another point. Normalisation _doesn't_ remove redundancy from your data! It replaces uncontrolled redundancy in data meant to be informative with controlled redundancy in the form of having the exact primary key of a row in a second table being referenced as a foreign key in a the first table.
    And the data in the first table refers to or is related to data in the second table.
    To find related data to the current row in the current table you do a join where the foreign key of the current row equals the primary key of the second.
    Actually more typically you'd have a join that returns a (psuedo) table consisting of many rows, each with all the columns of the first table and all columns of the second, but only where the foreign key of the row of the first table matches the primary key of the row of the second.
    There will be just one match at most per row of first table, because each foreign key only has on value, indeed, that's true of any row/column intersection, it's a singular value, AND you can't have more than one row in the same table with the same primary key.
    But you _can_ have one row in the second table turn up more than once in a join. Think of an address. People can share them.
    But we wouldn't want to _store_ it multiple times, because maybe we'd like to edit it, let's say a suburb is subdivided or renamed... So maybe we put each distinct address as a row of a table.
    But normalisation has a cost. Namely that if we have selected a person, we don't have address, so every time we need a join to find it. Which is slower than just printing out a person row with all that extraneous shit already stuffed into it.
    So often database designers will practice strategic denormalisation. And/or use a 'view', basically a virtual table that resulted from a join. Because join, queries, etc. don't usually return actual new tables, but the results are kind of formatted in a way that resembles a table except you can't typically do queries on it without generating it again. Views remove that restriction.

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

    Awesome tutorial thank you

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

    Thanks Dave. 👍

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

    Great tutorial 👍

  • @nurlanshukurov3864
    @nurlanshukurov3864 9 месяцев назад +1

    (node:6036) [MONGODB DRIVER] Warning: useNewUrlParser is a deprecated option: useNewUrlParser has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version
    (Use `node --trace-warnings ...` to show where the warning was created)
    (node:6036) [MONGODB DRIVER] Warning: useUnifiedTopology is a deprecated option: useUnifiedTopology has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version
    hi, Dave. I got these warnings, how to solve them? Thanks!

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

      Just had the same error, did you solve it?

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

      @@mecklonfernandes5036 delete them, not needed anymore. Can't find any solution, but see new code bases that don't use them anymore.

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

    The Read operations are slow compared to sql.. only write operations are faster in no-sql

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

    I would like my web server to be entirely located on my device. I have also experienced some corruptions that happen with the built in fs (file system) occasionally erasing json files. I think it might happen when fs tries to read and write a file at the same time. What would you recommend I do if I wanted everything to remain on my pc? Is there a more stable alternative to using fs? Or a way to prevent the occasional json file deletion?

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

      I used JSON in the first part of this series, but starting at this video, I switch things over to MongoDB which I recommend. You can install MongoDB on your PC if you want.

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

    Hello Dave!
    In PHP and MySQL, before each query, the script needs to connect to the database first.
    In node.js, if I put the connection to mongoDB in the file that runs the application (in your example 'server.js'), then I don't need to connect to the database before each query?
    Thanks in advance!

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

      Yes, from the source code in the course resources: github.com/gitdagray/mongo_async_crud/blob/main/server.js
      You can see on lines 16 & 17 that connecting to the database is the first thing we do. Then on line 65, we listen for that connection.

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

      @@DaveGrayTeachesCode Thanks a lot for the explanation!

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

      @@DaveGrayTeachesCode One more thing: in node/express you don't need to close the database connection? Or does this only apply to mongodb?

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

    Hi Dave. Thank you so much for this tutorial series. Just completed this one and was presented with an error informing me of a deprecated function:
    - MongoParseError: option usernewurlparser is not supported
    After commenting that line out of the dbConn.js file the connection works. Are there any problems that not having this line in my code will cause?

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

      Hi Carl, technology keeps moving forward. Features will be deprecated and new ones will be added. I suggest following the info provided by the deprecation notice and all should be well.

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

      @@DaveGrayTeachesCode Thank you. Really appreciate it

  • @UdhayaKumar-me2lt
    @UdhayaKumar-me2lt 9 месяцев назад

    can able to access the routes like register, auth from your cloned code it just display unauthorized

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

      Yes, if you just clone the code and don't work through the course, you will miss some things.

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

    hello dev, I wanna know that the way it industry doing things? or your own practise?

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

      That's like asking "How do people do things?" Of course, they do things in many different ways. So do dev teams. In general, yes, I am doing things like other developers. Will you find that some dev teams in the industry do things differently. Yes, you will. Learn what you can and realize there is never usually only one way to achieve the goal.

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

    I can't find the .env file in the starter source code. Has it been removed?

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

      .env files should never be in a Github repository. They are used to store environment variables with values like API keys, database passwords, and other secrets. A .env file should always be added to the .gitignore file's filelist to insure it is not added to a code repository. You will need to create your own .env file for this tutorial. I hope this helps!

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

      @@DaveGrayTeachesCode Thank you so much for your fast reply! I'm a total beginner...

  • @fares.abuali
    @fares.abuali 3 года назад +1

    Great 👏

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

    In my login system iam building i have a coconut farmer coconut collector and a buyer and after login all three of them should navigate to their respective pages (an update profile page) there is no admin so how to alternate your app to according to my reqitments dave any suggestion will help me a lot

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

      I think I would apply user roles - covered earlier in this Node.js series - and you could route based on those.

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

      @@DaveGrayTeachesCode hi dave , can you kindly explain a bit more on this

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

    Nice

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

    hello sir i am working on a fullstack ecommerce website using react.js node.js mongodb .i am stuck at point of database connect can you help me with that
    i am using mongoose v6.3.1

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

      In this MongoDB series, I show how to connect to the database with Mongoose.

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

      @@DaveGrayTeachesCode I got the solution after some reasearch thankyou sir

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

      @@yogisha56 hey how did u fix it? i seem to be having the same problem where i cannot connect to my database. 'Error: unable to connect to databse:'

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

    MongoDB🐍🌮🌮🌮

  • @exe.m1dn1ght
    @exe.m1dn1ght Год назад

    tf is this man talkin

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

    {2023-10-11}