Most voted "sequelize-js" questions
Sequelize is a Javascript library for Node.js that allows easy access to Postgresql, Mysql, Sqlite and Mariadb databases and maps database records to objects and vice versa (ORM). Use this tag together from the database tag used when pertinent (e.g., syntax errors).
Learn more…128 questions
Sort by count of
-
5
votes1
answer1009
viewsPromises as function return in Node.js
I am using the Sequelize.js. framework to perform queries in the database, the result of the function find returns an object with 3 methods: success, error and complete Ex.:…
-
5
votes1
answer4672
viewsHow to use SQL "LIKE" in Sequelize?
I am developing using sequelize but as it is my first time using this ORM I am with some doubts. I have the code below to make a query in the database through an input type text but I am using the…
-
4
votes1
answer526
viewsNode.js Sequelize Error Relationships
In this relationship, A Questionnaire can have MANY Questions, when I run it in return I don’t get the ID of Questionário on the table of Questão, but both are created. Why this occurs? Here’s the…
-
3
votes1
answer63
viewsGraphql error with Sequelize
I have an error in the return of a Mutation. Apparently he can’t read the id field, but the object I send to Graphql has this field, and as I’m new to Graphql I don’t understand what the error…
-
2
votes1
answer866
viewsHow to make synchronous queries with Sequelize on Node.js
I started to stew Node.js not long ago and I am using the division of logic into modules. I have a UserSessionController validates whether the user session is still valid:…
-
2
votes1
answer772
viewsUser profiles for REST API access using Nodejs + ORM Sequelizejs
There is a way, or some cool package, to work with user profiles for access in certain endpoints of the REST API, as per each one’s permission? I am using Nodejs + Express + Sequelizejs as ORM.…
-
2
votes1
answer672
viewsDoubt Sequelize Node.js
In relation to sequelize i created a table in my pgadmin named TB_USER but I have a question when creating the model: const Sequelize = require('sequelize'); const db =…
-
2
votes1
answer630
viewsConfigure API for SQL Server Database
I have an API that I used with Mysql, but I had to switch to SQL Server. Unfortunately I never used SQL Server, I do not know if you need to download something to get. The API was made in JS. The…
-
2
votes1
answer536
viewsHow do I set a default value for a column in Sequelize?
I am using Sequelize (v5.0+) with Nodejs (with Express). I want that for the column status in my database has the default value (defaultValue) as true. Migration module.exports = { up:…
-
2
votes1
answer90
viewsHow to delete all FK records by deleting their "owner" with Sequelize?
I’m making a database and it has some properties and it has users. A user can have several properties, so in the properties table I inserted the column user_id, to reference the user. But when I…
-
2
votes1
answer97
viewsUpdate is not performed in the Database using Sequelize and Nodejs
I have the following route that is responsible for receiving the data coming from a form and doing an update of the data that is in my database router.post('/articles/update', (req, res) => { let…
-
2
votes0
answers23
viewsHooks Sequelize
For purposes of understanding: Node.js with database postgres running with Sequelize v4; Some fields of my database need to be persisted in encrypted database, by business requirement. Using the…
-
1
votes1
answer101
viewsQuery changing Join - Sequelizejs
How could you do this query using Sequelize? SELECT t1.* FROM Table1 t1 inner join Table2 t2 on t1.id != t2.t1_id
-
1
votes2
answers620
viewsWhere em Join - Sequelize
Hello, I want to do a search within several tables, for example: SELECT * from tab1 INNER JOIN tab2 ON tab1.tab2_id = tab2.id WHERE tab1.name LIKE '%blabla%' or tab2.title LIKE '%blablabla%' How…
-
1
votes0
answers100
viewsHow to run npm script on Heroku in production?
I need to use Migrations from Sequelize in a Nodejs application that is already in production in Heroku, but I don’t know how to add the scripts in package.json so that the database migrations are…
-
1
votes0
answers371
viewsHow to make a SELECT with CONVERT or CAST in the WHERE clause using sequelize
I need to select below using sequelize. SELECT COUNT(*) AS 'Count' FROM Table WHERE CAST(DatetimeField AS DATE) = CAST(GETDATE() AS DATE) So far I’ve managed to do using between but it’s not the…
-
1
votes1
answer245
viewsbeforeupdate sequelize does not work
I am trying to make the data update encrypted the user password but simply does not work and does not issue error. Have the following model of sequelize. import bcrypt from 'bcrypt'; export default…
-
1
votes1
answer1369
viewsDouble association with sequelize
I have the following relationship with the sequel // Tasks.js sequelize.models.tasks.belongsTo(sequelize.models.users, { foreignKey: { type: DataTypes.INTEGER, field: 'ASSIGNEE', allowNull: true },…
-
1
votes1
answer498
viewsHow to make condition in two different tables with sequelize?
How can I make this select in sequelize? select prestadores.status, financeiros.status as prestador_status from prestadores left join financeiros on prestadores.financeiro_id =…
-
1
votes2
answers544
viewsError starting nodejs+Sequelize+mysql project
When I try to start my project this giving the following error: D:\www\nodejs\master>node bin/www module.js:472 throw err; ^ Error: Cannot find module 'sequelize' at…
-
1
votes1
answer1208
viewsJson return error {"isFulfilled":false,"isRejected":false} + Node
I have the following code in the Node : var express = require('express'); var app = express(); app.get('/api/events', function(req, res, next) { var events = repositorio.ListAll(); res.json(events);…
-
1
votes1
answer108
viewsHow do I save a sequelize value to a variable in Node.js?
I use the following code var app = website.findOne({ where: { idwebsite: req.params.id } }) res.send(app); But the result on the screen is that {"isFulfilled":false,"isRejected":false} How do I save…
-
1
votes1
answer404
viewsError creating a table with sequelize "Typeerror: Cannot read Property 'sequelize' of Undefined"
I have the following error when trying to create a table: const Usuario = app.db.sequelize.define('user', { Typeerror: Cannot read Property 'sequelize' of Undefined My folder structure: My…
-
1
votes1
answer54
viewsHow to compare only dates in Sequelize?
I am using ORM Sequelize and would like to compare only one date instead of the date with time. I have the following date: 2021-05-06 03:00:00.0000000 +00:00 And I’m doing like this: const dataAtual…
-
1
votes0
answers64
viewsSequelizedatabaseerror - Syntax error when creating an ARRAY field in Graphql with sequelize and mysql
I am developing a basic API for blog graphql with Sequelize and Mysql as a database, everything works perfectly until I try to create a new keyword field of the Array type, for blog posts, I believe…
-
1
votes2
answers687
viewsSequelize making incorrect select
I have an api in nodejs www: ... db.sequelize.transaction() .then(() => { server.listen(port); server.on('error', onError); server.on('listening', onListening); }) ... models: 'use strict';…
-
1
votes1
answer173
viewsSequelize Associantions
I have 2 models: user Features: const DataTypes = require('sequelize'); const database = require('../config/dbconnection'); const user= require('./user'); const user_features =…
mysql node.js join mariadb sequelize-jsasked 5 years, 8 months ago Guilherme Monteiro de Oliveira 21 -
1
votes0
answers1053
viewsPagination with sequelize + Node.js
Hello, I am developing an application Node.js where I have to list a register of classes. But as the number of records are many need to make a pagination, I achieved this by making a function with…
-
1
votes1
answer648
viewsAssociations with Node.JS / Sequelize
Good evening dear friends, I’m developing an API with Node.JS / Express / Sequelize and I need some help. As it is the first time that I use relational databases with Node, I don’t know exactly how…
-
1
votes1
answer911
viewsRelationship between tables with Sequelize
I have two tables, one for Collaborator and one for Sector. A collaborator belongs to a sector and a sector contains several collaborators. I managed to create the tables, however, I don’t know how…
-
1
votes1
answer245
viewsGroup data with Sequelize and My SQL
Talk young, everything jewels with you? I need a help that is the following, I want to make returns the data to groups as follows id_categoria1: [ { id: 1, nome: "Arquivo tramitação 1", arquivo_url:…
-
1
votes2
answers454
viewsError when creating a bank with Sequelize
Opa, I am creating a Rest API in Nodejs and using Sequelize as ORM only when I try to use the db:create command of the sequelize to create the database, it returns me this error: ERROR: Dialect…
-
1
votes2
answers228
viewsSeparating elements from an array for sequelize query
This id_message I send by parameter by my request, a console.log in this returns me the value of the image. const id_mensagem = [...new Set(response.data.map(mensagens => mensagens.id_mensagem))]…
-
1
votes0
answers19
viewsPerform query - relation Many to Many - Sequelize
I have a problem to perform a query using the Sequelize ORM. The structure is as follows: Migrations/tables: Developers, Technologists, developers_dechnologies. The relationship between developers…
-
1
votes0
answers26
viewsDisplay sequelize related table result
Good would like the help of you gentlemen, I have two tables customer and product a customer may have several products and one product belongs to only one customer, I have a relationship using…
-
1
votes2
answers53
viewsENUM Sequelize Error
I get the error RangeError: Maximum call stack size exceeded in my model statement. Follow code below: const { Model, DataTypes } = require('sequelize') class Usuario extends Model { static…
-
1
votes0
answers22
viewsStructuring data from DB
Hello fellow developers, I have a query that brings geographical areas that are contained in larger units of area; these larger units are received via params (id) and may be one or more, without…
-
1
votes0
answers13
viewsFormat date field to display on the EJS page with Node.Js
I am using Node.JS to retrieve data from a Mysql table, but I would like the date field to be displayed in the EJS view in the "DD/MM/YYYY" format. Showing "Thu Jul 15 2021 18:00:00 GMT-0300…
-
0
votes1
answer80
viewsError in separating responsibilities
On Node, I created the following template to represent my user: "use strict"; var Sequelize = require('sequelize'); module.exports = function() { return sequelize.define('user', { ID_USER: { type:…
-
0
votes2
answers830
viewsUnhandledpromiserejectionwarning: Sequelizedatabaseerror: Table 'salao. Users' doesn’t exist
Good morning, I’m facing the following problem Executing (default): INSERT INTO `Users` (`id`,`name`,`email`,`avatar`,`password_hash`,`provider`,`createdAt`,`updatedAt`) VALUES…
-
0
votes1
answer237
viewsHow to handle errors in sequelize create
Hello, I would like to know how I can treat possible errors when performing a create with sequelize for example considering the following insertion Livros.create({ BK_TITLE: data.title, BK_GENRE:…
-
0
votes1
answer290
viewsSequelize Migrate - Error: Typeerror: defineCall is not a Function
Hello I’m doing a simple championship API, I used the Sequelize as ORM for my database. I created the Arbitro table that had only the NAME field and did not have the CPF field in the table. I had to…
node.js postgresql migrations sequelize-jsasked 7 years, 7 months ago Leonardo Nascimento Cintra 175 -
0
votes2
answers721
viewsMysql sequelize error in Docker
I can’t connect the mysql api to Docker, but I can run mysql on Docker from the terminal index js. const db = require('../config/database'); const sequelize = new Sequelize(db) module.exports =…
-
0
votes1
answer323
viewsSearch for record in another table with mysql and sequelize
How to search the column record nome on the table categoria, for id that was saved in the table postagens? const db = require('./db') const Post = db.sequelize.define('postagens', { titulo: { type:…
-
0
votes1
answer55
viewsField multiplication in Sequelize
I have the following code thingy: const buys = await Buy.findAll({ where: { account_id: req.params.id, }, attributes: ['id', 'account_id', 'buy_value', 'quantity'], }); return res.json(buys); That…
-
0
votes0
answers725
viewsRelationships hasOne and belongsTo in the same sequelize model
Good am using sequelize along with nodejs and I’m having difficulties with a relationship. I have 3 tables where (location, Equipment, Shed, area) where in one location I have 1 equipment…
-
0
votes1
answer65
viewsHow I remove the String from inside a Sequelize return
I made a select by Sequelize and it brings me this: [ TextRow { permission: 'group.default' }, TextRow { permission: 'group.fundador' } ] But how do I get only the 'group.#' of that array? I want…
-
0
votes0
answers44
viewsSequelize Upsert does not return to Row
Why the Sequelize is not returning me to Row in the method Upsert? According to the documentation should return Promise<Model, Boolean|null> the option of returning already is true by default.…
-
0
votes0
answers186
viewsHow to change the connection to the database using Sequelize+Mysql+Express depending on the parameter sent in the request?
For example, when receiving a request parameter equal to db1, in the precise controller that uses the db1 connection string When starting the Nodejs server the configuration made in the config.json…
-
0
votes0
answers17
viewsSequelize -Encrypted Password Update using bcyrpt
I have a problem password update with Sequelize. The problem is when I try to update, the password that was previously encrypted by bcyrpt, loses the encryption. below the code where I try to do…
sequelize-jsasked 3 years, 6 months ago Alexandre Cruz 1