javascript - Find all instances of "modelA" with no asscociated instances of "modelB" using sequelize -
i using sequelize, node.js module.
i want findall instances of modela have no associated instances of modelb.
each instance of modela hasmany instances of modelb.
this current attempt not working.
modela.findall({ logging: console.log, where: { //- number of modelb === 0? } include: [ { model: modelb, where: { //- doesn't exist? }, }, ], }) i included logging: console.log, show needs output single mysql query can run elsewhere, why i'm not filtering users in next promise in promise chain after returning users.
this should work
modela.findall({ logging: console.log, include: [ { model: modelb, where: { modela_id: {$ne: null} }, }, ], })
Comments
Post a Comment