Орм sequelize , база mysql.
modules.app.post('/views',(request,response)=>{
pndlist.findOne({where: {id: request.body.dataPnd}}).then(pnd=>{
if(!pnd) return;
pnd.getOtds().then(otd=>{
for(otds of otd){
console.log(otds.name);
}
});
});
console.log(request.body);
response.json(request.body.dataPnd);
});
Ошибка
Unhandled rejection TypeError: pnd.getOtds is not a function
at /var/www/html/app/index.js:71:7
at tryCatcher (/var/www/html/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/var/www/html/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/var/www/html/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/var/www/html/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/var/www/html/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/var/www/html/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/var/www/html/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/var/www/html/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/var/www/html/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:439:21)
В чем может быть проблема?