After executing a Sequelize findAll query on a table, I received 2994 rows. However, when I performed a SELECT COUNT(*) directly in the database, it returned 11909 rows for the same table. Below is an example of the code snippet:
// SELECT COUNT(*) FROM collection; executed in the database returns 11909
const test: number[] = (await Collection.findAll({
attributes: ['id']
})).map((collection: Collection) => collection.id);
console.log(test.length); // 2994
I have double-checked my Sequelize model and everything seems to be configured correctly. I'm puzzled as to why Sequelize.findAll() does not return all the expected rows. If anyone has encountered this issue before, your assistance would be greatly appreciated.