This repository contains a sample database of Movies, Actors, and Genres. It uses the sequelize.js library to create database models. In this repo we will be learning how to use sequelize.js by implementing functions and making their tests pass. You can run the code and tests as follows:
# clone this repo to your computer
npm install
npm test -- --watchAll
This will run all of the tests, and continuously re-run them as you implement the functions in the file learn-sequelize.js
.
Task: Implement the functions in learn-sequelize.js
You can use the following resources to learn more about the Sequelize.js library.
https://sequelize.org/v5/manual/data-types.html
https://sequelize.org/v5/manual/models-definition.html
https://sequelize.org/v5/manual/models-usage.html
.findByPk()
.findOne()
.findAll()
- using WHERE
{ where: { column: value }}
- using AND/OR: https://sequelize.org/v5/manual/models-usage.html#complex-filtering---or---not-queries
- All Options for complex WHERE querying, limiting, ordering (sort) https://sequelize.org/v5/manual/querying.html
https://sequelize.org/v5/manual/instances.html
.create()
- updating fields and
.save()
.destroy()