Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

make custom queries using sequelizejs

I am using sequelizejs orm in my nodejs app. And I dont have its documentation mentioning how to make custom sql queries. I found an example by googling but couldnt understand its syntax. and what the role of this callee function.

  var callee = {
                    build: function(result, config) {
                        console.log("callee", result);
                    }
                };
                sequelize.query("SELECT * from Users", callee).on("success", function(){
                    console.log("success");

                });
like image 512
Kamal Reddy Avatar asked Dec 18 '25 10:12

Kamal Reddy


1 Answers

If you just want to execute custom query and fetch the results of it you can do

sequelize.query('sql query', null, { raw: true }).success(function(data){})

If you need smth else, please explain what you want to achieve :)

like image 150
sdepold Avatar answered Dec 21 '25 03:12

sdepold



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!