How to create MongoDB Schemas and Data Models | Node.js Tutorials for Beginners

  Рет қаралды 61,844

Dave Gray

Dave Gray

Күн бұрын

Web Dev Roadmap for Beginners (Free!): bit.ly/DaveGrayWebDevRoadmap
Learn how to create MongoDB schemas and data models in this Node.js tutorial for beginners. A MongoDB schema allows you to define the shape and content of documents in a collection. Data models allow applications to interact with the data in a collection.
🚩 Subscribe ➜ bit.ly/3nGHmNn
🚀 This tutorial is part of a Node.js & Express for Beginners tutorial series playlist:
• Node.js Tutorials for ...
🔗 Starter Source Code: github.com/gitdagray/mongodb_...
🔗 Completed Source Code: github.com/gitdagray/mongodb_...
How to create MongoDB Schemas and Data Models | Node.js Tutorials for Beginners
(00:00) Intro
(00:05) Welcome and Overview
(00:46) Mongoose JS Docs
(02:08) Create an Employee schema
(04:25) Create an Employee data model
(05:53) Create a User schema
(08:23) Create a User data model
(08:49) Refactor the register controller with the User data model
(15:29) Test the register route with Thunder Client
(17:36) View the new user data at MongoDB.com
(20:19) Assignment / Challenge
🌱 MongoDB and Mongoose References:
MongoDB: www.mongodb.com/
Mongoose: mongoosejs.com/
📚 JWT References:
Intro to JSON Web Tokens: jwt.io/introduction
All You Need to Know About Storing JWT in the Frontend: dev.to/cotter/localstorage-vs...
NPM jsonwebtoken package: www.npmjs.com/package/jsonweb...
NPM cookie-parser package: www.npmjs.com/package/cookie-...
Deleting Cookies: expressjs.com/en/api.html#res....
Cross-Site Scripting (XSS): owasp.org/www-community/attac...
Cross-Site Request Forgery (CSRF): owasp.org/www-community/attac...
REST Security Cheat Sheet: cheatsheetseries.owasp.org/ch...
📚 Login References:
Bcrypt: www.npmjs.com/package/bcrypt
How to Safely Store a Password: codahale.com/how-to-safely-st...
MDN: HTTP Response Status Codes: developer.mozilla.org/en-US/d...
📚 More References:
Node.js Official site: nodejs.org
NPM Official site: www.npmjs.com/
Express JS Official site: expressjs.com/
MDN CORS: developer.mozilla.org/en-US/d...
NPM CORS: www.npmjs.com/package/cors
✅ Follow Me:
Twitter: / yesdavidgray
LinkedIn: / davidagray
Blog: yesdavidgray.com
Reddit: / daveoneleven
Was this tutorial about Mongoose Schemas and Data Models for MongoDB with Node.js helpful? If so, please share. Let me know your thoughts in the comments.
#mongodb #mongoose #nodejs

Пікірлер: 47
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
In this tutorial, we'll use Mongoose JS to create Schemas that will define the shape and types of our MongoDB data. We'll also create Mongoose JS data models that will allow our app to interact with our data collections and documents stored in MongoDB. Finally, we'll apply the data model to the user registration route in our Node.js and Express REST API. If you're just getting started with Node.js, I suggest starting at the beginning of this Node.js Tutorials for Beginners series here: kzbin.info/aero/PL0Zuz27SZ-6PFkIxaJ6Xx_X46avTM1aYw
@demiontongov4319
@demiontongov4319 7 ай бұрын
wow, this is interesting
@thescholar6511
@thescholar6511 2 ай бұрын
this is nice, but i would like to see the video before this one. did you take it down?
@vladislavamarkova8379
@vladislavamarkova8379 2 жыл бұрын
I so much appreciate your tutorials... And I want to thank you for the time and effort to make these explanatory examples and in a way so that we can understand and further use these techniques. It was your tutorials on nodejs and etc. that gave me the right base so to have the desire to learn and gain experience with more practice. 🙏
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Thank you so much, Vladislava! Comments like yours keep me going. I started this channel to help others learn, and it is great to know that's what I am doing. 💯
@yashwantg5045
@yashwantg5045 2 жыл бұрын
You have explained so much in depth and so easily that even beginner like me understood everything
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
That's great to hear! Thank you for the comment. 💯
@themixmaster
@themixmaster 2 жыл бұрын
Thanks for the cool tutorial, it's great that such videos available in the public!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
You're welcome! 💯
@yoshi8171
@yoshi8171 2 жыл бұрын
Great tutorial as usual ! Leaning through your courses, I’m improving not only my programming skills but also my English as well😁
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Good job! Keep it up! 💯
@ahmad-murery
@ahmad-murery 2 жыл бұрын
Same here
@nicolesyflaire2280
@nicolesyflaire2280 5 ай бұрын
Congratulations on your 1000th like!
@benarcher372
@benarcher372 2 жыл бұрын
Soon 10k subscribers. Well deserved.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Thank you, Ben!
@CarlosWashingtonMercado
@CarlosWashingtonMercado 5 ай бұрын
Nice message at the end of the video. 🙂
@sonamohialdin3376
@sonamohialdin3376 2 жыл бұрын
Amazing tutorial thank you
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
You're very welcome! 💯
@szymonrojek6480
@szymonrojek6480 2 жыл бұрын
Hi Dave, I can not find the next part ot this tutorial which you mentioned in this video at the end (after refactor with MongoDB auth), is it available? many thx I love all your videos! great job
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Thank you! Here's the full playlist: kzbin.info/aero/PL0Zuz27SZ-6PFkIxaJ6Xx_X46avTM1aYw
@sayidradhinpm8761
@sayidradhinpm8761 Жыл бұрын
Amazing 🎉.There are two benifit, it improved my english and i coding...
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Glad to hear that!
@al-kishk6782
@al-kishk6782 21 күн бұрын
pls a video explaining the relationship between models. pls
@_ademmeral
@_ademmeral 11 ай бұрын
Sir, VsCode's intellisense is too laggy after installing mongoose. Do you have any idea about that? I didn't found any solution yet =\
@pablovaldes2397
@pablovaldes2397 Жыл бұрын
awesome tutorial man, very useful, the source code you provided too is also really nice, thank you
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
You are welcome!
@oryankibandi3556
@oryankibandi3556 2 жыл бұрын
Quick question: I've noticed in this series we are hashing the users password in the backend. Is it safe sending the user's password on a http request to the backend without hashing it from the frontend?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Nothing frontend is 100% safe, but I prefer hashing on the backend for storage. Send from the frontend using a post request.
@oryankibandi3556
@oryankibandi3556 2 жыл бұрын
@@DaveGrayTeachesCode Thank you. The content on your channel is amazing.Great stuff.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
@@oryankibandi3556 thank you for the kind words!
@AmitKumar-tw1sj
@AmitKumar-tw1sj Жыл бұрын
Which theme are you using? Also great video!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Thank you! I made a short about my theme choice: kzbin.infodp4u1NNFhtE
@ayushgandhi577
@ayushgandhi577 2 жыл бұрын
I hope you will create a tutorial on mongodb advance topic like aggregation and sharding in future as well😀
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Thanks for the suggestion! 🙏 💯 Have you also looked at MongoDB University? They offer free courses for developers with a certification upon completion: university.mongodb.com/
@ayushgandhi577
@ayushgandhi577 2 жыл бұрын
@@DaveGrayTeachesCode Wow, I don't know about these free MongoDB courses. Thanks, Dave
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
@@ayushgandhi577 you're welcome! When you get to the dev course, there are also language choices like JS, Python, etc. I think it has been updated since, but I took it with Python about 3 years ago.
@yoshi8171
@yoshi8171 2 жыл бұрын
@@DaveGrayTeachesCode Great source to learn mongo db! Thanks.
@ahmad-murery
@ahmad-murery 2 жыл бұрын
@@DaveGrayTeachesCode Thanks for the link Dave, I must have a look.
@sakamoshikaka9939
@sakamoshikaka9939 Жыл бұрын
Hi, where is your cods for downloading? I checked and search everywhere I could. You said its available for downloading.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
There are two links in the description labeled "Starter Source Code" and "Completed Source Code".
@UHTWW
@UHTWW Жыл бұрын
Hi, for anyone who's trying to call the route and for some reason the request failing, try to add the cors, origins and body parser.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Hello, if you look at the starter source code link in the description, you will see how CORS is set up. Also note that body parser is outdated. The starter source code has the middleware for parsing json and cookies applied. You can go back through the following playlist to see how everything was built: kzbin.info/aero/PL0Zuz27SZ-6PFkIxaJ6Xx_X46avTM1aYw
@UHTWW
@UHTWW Жыл бұрын
@@DaveGrayTeachesCode Thank you. I forgot to say very good videos.
@Pareshbpatel
@Pareshbpatel 8 ай бұрын
{2023-10-11}
MongoDB Schema Design Best Practices
50:39
Joe Karlsson
Рет қаралды 168 М.
I Can't Believe We Did This...
00:38
Stokes Twins
Рет қаралды 43 МЛН
Osman Kalyoncu Sonu Üzücü Saddest Videos Dream Engine 170 #shorts
00:27
MongoDB Crash Course - Schemas and Relationships
46:28
The Full Stack Junkie
Рет қаралды 42 М.
Mongoose Crash Course - Beginner Through Advanced
33:36
Web Dev Simplified
Рет қаралды 450 М.
JWT Authentication | Node JS and Express tutorials for Beginners
1:00:03
Build A Restful Api With Node.js Express & MongoDB | Rest Api Tutorial
53:55
The Principles of Data Modeling for MongoDB
27:45
MongoDB
Рет қаралды 10 М.
MongoDB in 100 Seconds
2:27
Fireship
Рет қаралды 998 М.
Data Modeling with MongoDB
34:56
MongoDB
Рет қаралды 106 М.
I Can't Believe We Did This...
00:38
Stokes Twins
Рет қаралды 43 МЛН