I have not used Sequelize, but after reading its documentation, it’s obvious that you are instantiating a new object, that’s why Sequelize inserts a new record into the db.
First you need to search for that record, fetch it and only after that change its properties and update it, for example:
Project.find({ where: { title: 'aProject' } }) .on('success', function (project) { // Check if record exists in db if (project) { project.update({ title: 'a very different title now' }) .success(function () {}) } })
Related Posts:
- Node.js MySQL – Error: connect ECONNREFUSED
- Node.exe Stuck at 100% CPU
- Cannot add or update a child row: a foreign key constraint fails
- How do I debug error ECONNRESET in Node.js?
- sql query with multiple where statements
- node.js, Error: Cannot find module ‘express’
- Cannot delete or update a parent row: a foreign key constraint fails
- ERROR 2003 (HY000): Can’t connect to MySQL server on localhost (10061)
- Rename a column in MySQL
- Not unique table/alias
- Install mysql-python (Windows)
- Significance of port 3000 in Express apps
- #1055 – Expression of SELECT list is not in GROUP BY clause and contains nonaggregated column this is incompatible with sql_mode=only_full_group_by
- Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
- Disable ONLY_FULL_GROUP_BY
- MySQL WHERE IN ()
- Is there an SQLite equivalent to MySQL’s DESCRIBE [table]?
- Error: Cannot find module ‘ejs’
- SELECT list is not in GROUP BY clause and contains nonaggregated column …. incompatible with sql_mode=only_full_group_by
- Host ‘xxx.xx.xxx.xxx’ is not allowed to connect to this MySQL server
- difference between primary key and unique key
- How to export a mysql database using Command Prompt?
- MySQL Error #1133 – Can’t find any matching row in the user table
- How can I prevent SQL injection in PHP?
- Best way to store an array in MySQL database?
- Unknown Column In Where Clause
- Error: Cannot find module html
- Cannot connect to Database server (mysql workbench)
- mysqld: Can’t change dir to data. Server doesn’t start
- How to solve “Error: MySQL shutdown unexpectedly”?
- Advice on loopback.js vs express js
- Can you do a For Each Row loop using MySQL?
- Drop all databases in MySQL
- bodyParser is deprecated express 4
- How to properly create composite primary keys – MYSQL
- Failed to Connect to MySQL at localhost:3306 with user root
- MySQL – count total number of rows in php
- How to get the count of each distinct value in a column?
- Data is not constantly loading from custom wordpress table
- How to run WordPress across 2 VMs for high availability
- Mysqldump add drop table?
- How to disable `SQL_CALC_FOUND_ROWS` [duplicate]
- “#1067 – Invalid default value for ‘post_date'” when trying to reset AI after backup
- #1115 – Unknown character set: ‘utf8mb4’
- WordPress Deadlock Error
- How to do a MySQL dump from production site without using a search and replace script for local development?
- How to bulk edit canonical url’s in SQL?
- Concurrent / simultaneous MySQL connections
- How to check for empty and not a failure
- How many ‘wp_insert_post’ calls can be performed in one shot, in a very long ‘for’ loop?
- Keeping database within limits, please help!
- Best settings for MySQL to speed up site? [closed]
- HTML Entities in Post Title
- Can’t find my wordpress DB in phpmyadmin
- Deprecated: mysql_connect():
- MySQL Rank & $wpdb
- $wpdb select all meta for each post
- Calculate average crossing post categories
- Replacing link URL ending strings via MySQL
- Site not responding error – taking long to load [closed]
- Many slow queries post_type = ‘attachment’;
- SQL command to convert all tags in lowercase?
- Problem with admin login after deployment
- Find out how many times the user has logged in
- WordPress(wpdb class) and mysql stored procedures
- Is it possible to create a WordPress table using array and loop?
- Can’t run database query
- How to stop $wpdb from prepending database name
- Match tag names with form titles
- Error missing MySQL extension
- Getting Error Trying to Create Table
- Best approach for a custom database filling in WP custom post types
- Understanding custom php that reads from WP MYSQL
- Why doesn’t custom mysql query return results? Is syntax correct?
- Insert two row in wordpress database
- SQL statement using placeholder is not returning results
- How to Bulk find and replace MySQL for post image url
- Wpdb query with dynamic table name
- Regular XML-RPC timeouts
- update multiple rows in mysqli table base on two values
- Extract all users along with yoast metadata description
- WordPress asks to install, but is already installed?
- How can I verify WordPress nonce from the following code?
- Deleting a table row through query
- How to write in MySQL more characters in user_nicename
- $wpdb->get_var not returning count
- Custom user query – orderby meta_key (that may not exist)
- How to get Attachments(image) with specific width\height ratio
- What is the cron doing?
- Simple SQL Query in wordpress
- Apache Redirect based on WordPress permissions
- SQL error on restoring database
- MySQL database gives blank page (white screen of death)
- Datatabase error: Commands out of sync
- why is $wpdb->update() causing a DB error from within wp_set_password()
- Global MySQL replacing of text patterns/matches
- remove wordpress post links
- SQL get last entry of a specific gravity form
- mysqldump to a tar.gz
- Where is my mysql log on OS X?