So i basically trying to get string value from database into an Array using Sequelize: with my code showed as below, i try sequelize literal to change it but i cannot resolve how to turn it from string into array and split it by “,” (comma): what i want is like this is there is somthing wrong with my code
Tag: sequelize.js
Express Can’t “findAll” Users By Key, Only By Email
I have a simple Express/Pug app that is supposed to allow me to search users in a database by “email” and by “key.” In this schema, a key is simply a string that each user is assigned. My user model and index model files look like this: models/index.js: models/users.model.js: My controller file looks like this: controllers/users.controllers.js: My users route looks
Sequelize table is not created, even though I used Sequelize.define()
Repository (code): https://github.com/JavascriptLearner815/spelta-discord-bot/tree/development I am creating a Discord bot with Discord.js. I wanted to add three DM commands for the bot: dm, reply, and followup. In order to reply to the last DM, I needed to use SQLITE. I made and required a database.js file to do that, using the discord.js guide for SQLite. But when I run the command
Update a field of an associate table using the magic method of Sequelize/Node js
I have i table called Orders and another table called Cupons, this tables has a association many to one, Ordes has many cupons, and cupons belongs to order, i need to update the status of my cupom when i associate the cupons to a order, i tried this way but doesn’t work Answer You can only create a parent and
Select All Records with Sequelize ORM when having One-To-Many relationship
I have two tables Users and Shops, User can have multiple shops, and shop can be owned by one user. I’m using Node.js & Sequelize ORM (postgres) The Problem When fetching data from Shop Model, Sequelize add extra field UserId in select query like: This Query Excecuted when I do: This Line Throws Exception says `error: column “UserId” does not
using socket how to broadcast message to specific users who has role_id = 1
Using Socket and node express i want to send a message to all users who has role_id 1 but whenever i broadcast message all users receive it. status has nothing with message. its just updating user status Answer
Sequelize: column name to lowercase not working with included models
I have two models: Category and Bookmark. Bookmark is associated with category through categoryId column. Category also have name, createdAt, orderId columns; I can get category and all its bookmarks with: But now I want to change how bookmarks are ordered. Order type can be name, createdAt or orderId; It works fine when orderType is createdAt or orderId but fails
How to use Sequelize associations with .then in controller
This is my ToWatch Model in toWatch-model.js file which in code has UserModel->ToWatch 1:1 relationship and has ToWatch->MovieModel 1:M relationship. I watched many tutorials, but being my first time trying to make a method that will return everything including something from my other table via ID, I wasn’t sure where to put and how to put data that I need
How to find user first name letter
How can I find user with first letter in their name like for example my name is “Nathan” and when I type “n” in search input it will show user start with an “n” but not user that not start with letter “n” but contain letter “n” like Henry, Connor.. here is my searchController.js: and here is my model user.js:
returning extra column with formatted date
I have a schema(table) like following in seqluelize: My requirement is whenever I call or use or include this schema order_entry_header in any place in my app I want date column in to format in a readable text in a different column called date_format In simple sql this should be something like below: I am joining/fetching this table data in