include Sequelize.col s.replace is not a function
See original GitHub issueIssue Description
What are you doing?
I get an exception when querying data through the association table and combining fields. For example, collections is the main table, collection_products is the associated table, and products is the associated word table. The query statement is as follows:
await model.collections.findOne({
include: [
'images',
{
model: model.collection_products,
as: 'products',
attributes: ['id', Sequelize.sequelize.col('product.title')],
include: {
model: model.products,
as: 'product'
}
}
],
where: {
handle: this.ctx.params.handle
}
})
What do you expect to happen?
输出结果
{
"id": "9259e355-b30e-47ab-9da6-6289c65b98b0",
"title": "Photo Engraved Necklaces",
"images": [
{
"id": "e4b4ebda-726c-42dc-868d-fc2984f8b4bc",
}
],
"products": [
{
"id": "4b750c88-ddaa-4605-9f5c-318011651d25",
"title": "Engraved Double Heart Birthstone Promise Ring Silver",
"handle": "engraved-double-heart-birthstone-promise-ring-silver",
},
{
"id": "adb04f9e-d35a-49d1-a6b3-ef879a62663d",
"title": "I Love You Bracelet In 100 Languages Projection Engraved Bracelet Four",
"handle": "i-love-you-bracelet-in-100-languages-projection-engraved-bracelet-four",
}
]
}
What is actually happening?
An error message was output
s.replace is not a function
Additional context

Environment
- Sequelize version: 5.21.12
- Node.js version: v13.12.0
- Operating System: windows 10
Issue Template Checklist
How does this problem relate to dialects?
- I think this problem happens regardless of the dialect.
- I think this problem happens only for the following dialect(s):
- I don’t know, I was using PUT-YOUR-DIALECT-HERE, with connector library version XXX and database version XXX
Would you be willing to resolve this issue by submitting a Pull Request?
- Yes, I have the time and I know how to start.
- Yes, I have the time but I don’t know how to start, I would need guidance.
- No, I don’t have the time, although I believe I could do it if I had the time…
- No, I don’t have the time and I wouldn’t even know how to start.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
TypeError: s.replace is not a function - Stack Overflow
And to anybody getting s.replace error it is basically because you are not passing the expected type of argument. So in above case, ......
Read more >[Solved]-TypeError: s.replace is not a function-sequelize.js
And to anybody getting s.replace error it is basically because you are not passing the expected type of argument. So in above case,...
Read more >TypeError: replace is not a function in JavaScript | bobbyhadz
The "replace is not a function" error occurs when we call the replace() method on a value that is not of type string...
Read more >How to solve the "is not a function" error in JavaScript
We are not required to add them. Sometimes, however, we must pay attention. In particular, in Node.js we use require() to load external...
Read more >Upgrade to v6 - Sequelize
Option returning: true will no longer return attributes that are not defined in the model. Old behavior can be achieved by using returning: ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Getting this error while doing bulk insert
I’m running into this error when I use a calculated index field in conjunction with
upserton a Postgres database.