Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
966 views
in Technique[技术] by (71.8m points)

node.js - How to use array_agg() in sequelize?

I want to use array_agg() function with sequelize. How can I do that ? I have been used below code, but it doesn't work.

let statusTabs = await Parameters.findAll({
    where: {
        param_key: 't_status',
        param_name: ['Washing', 'Awaiting', 'Pending']
    },
    attributes: [
        sequelize.literal('array_agg(param_key)'),
        sequelize.fn('array_agg', sequelize.col('param_key'))
    ]
});

It is giving errors like below -

TypeError: Cannot read property 'fn' of undefined

TypeError: Cannot read property 'literal' of undefined

How can I get array_agg() to work ?

question from:https://stackoverflow.com/questions/65935841/how-to-use-array-agg-in-sequelize

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...