Question

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");

                });
Was it helpful?

Solution

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 :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top