Issue
I'm using Sequelize to query my items from the local Postgres database, then I found something really scary.
I just query all database entries of a specific model using:
model.findAll({attributes: ["columnName"]}).then((data) => {
console.log(data.length); // logged: 800
});
Everything looks good, but then I went and bind the Postgres datasource directly from my IDE, opened a console from there and ran the same query to validate the overall number of items returned from Sequelize:
select count(*) from tableOfModel; # returned: 600
I got a shock from that moment as the number of items I was getting was only a total of 600 items and was different from what I got with Sequelize.
What might be wrong here?
Solution
I found where the error was: a collaborator changed the database configuration without telling me so, so the database was remotely hosted on server, so everything was okay with Sequelize. I should have noticed it at first :).
Answered By - Manifest Man Answer Checked By - Robin (sql.easybugfix Admin)
Post a Comment
Post a Comment