Similar to Mongoose, Sequelize relies on model definitions and will create the needed tables in your database. In this video, learn how to define models and relations for orders and order items.
- [Instructor] Model creation for Sequelize…is a little bit similar to what we did for Mongoose,…but there are differences as well.…First of all, we need a little bit of infrastructure…that actually loads those models into Sequelize…and I created that already for you.…You'll find in models, sequelize, index.js,…you'll find the model loader.…I took that from the link here on top of the file.…Let's go through this file we've created.…What it does, it goes through the local directory…and sees if there are other files in it as well,…and if so, it assumes that this is a Sequelize model…and it will call sequelize.import, and we'll parse then…the file name to it and it will store the model…that this Sequelize input returns in an object db…that was declared up here in line eight.…
Next, it will run through all those models…that were declared and we'll look for a property,…associate on it, and if so, it will call associate…and we'll parse in this db object will all other entities.…After that, we call sequelize.sync.…
- Basics of relational and nonrelational databases
- Preparing your environment
- When to use document databases
- Inserting data into MongoDB
- Basic insert operations for MongoDB
- Querying data from MongoDB with Node.js
- Using key-value stores
- Using relational databases with Node.js
- Adding MySQL and Sequelize to a project
Skill Level Intermediate
Node.js: Extend and Maintain Applicationswith Daniel Khan3h 35m Intermediate
Node.js: Build Your First Microservicewith Daniel Khan2h 9m Intermediate
Building a Website with Node.js and Express.jswith Ray Villalobos3h 16m Intermediate
1. Get Started with Databases for Node.js
2. Prepare Your Environment
3. Use Document Databases with Node.js
4. Use Key-Value Stores with Node.js
5. Use Relational Databases with Node.js
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.