You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This documentation indicates that ANY time the "type" parameter is specified, the returned result is the row, without the counts. However, looking at the actual code:
This is NOT the case with insert/update/raw. This should either be adjusted in the documentation to mention excluded cases, or should be updated in the Query to return the expected result for these other cases. I vote the latter personally, as it provides more code flexibility in general - but I do understand that would be a breaking change, since people would have had to work around this issue by now.
It should also be noted, that this was working properly in sequelize v3. When I started migrating to v4, this issue presented itself. Here's the example query I had to modify as a result:
return sequelize.query(sql, {
type: models.Sequelize.QueryTypes.UPDATE,
replacements: {
jobId,
status: metricStatuses.PROCESSING,
workerMeta: JSON.stringify(workerMeta),
},
raw: true,
})
.then(_.first) ////////// this shouldn't be needed, docs say setting the type avoids this
.then(_.first);
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment 🙂
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment 🙂
https://github.com/sequelize/sequelize/blob/ff1c97cd9264d50c1d779b31a8d38dd4182ddfaa/lib/sequelize.js#L427
This documentation indicates that ANY time the "type" parameter is specified, the returned result is the row, without the counts. However, looking at the actual code:
https://github.com/sequelize/sequelize/blob/ff1c97cd9264d50c1d779b31a8d38dd4182ddfaa/lib/dialects/postgres/query.js#L261
This is NOT the case with insert/update/raw. This should either be adjusted in the documentation to mention excluded cases, or should be updated in the Query to return the expected result for these other cases. I vote the latter personally, as it provides more code flexibility in general - but I do understand that would be a breaking change, since people would have had to work around this issue by now.
It should also be noted, that this was working properly in sequelize v3. When I started migrating to v4, this issue presented itself. Here's the example query I had to modify as a result:
The text was updated successfully, but these errors were encountered: