Hi everyone! I'm new to databases, sequelize and other stuff but I'm trying to learn!
I have this table called "Posts"
and I have like 3 fake migrations
What I want is to have back only a value.
I've seen this but it doesn't really help me...
So if I want "ipsum" I can write this SQL in DBeaver: select * from "posts" where "type"='ipsum'. And it works.
But I need to do the same in Sequelize.
I tried
export const loadNewPost = async (components) => {
try {
const newPost = await components.db.Posts.findAll({
where: {
type: "ipsum",
},
});
return newPost;
} catch (e) {
throw e;
}
};
But it doesn't work! (then I should place this function into an endpoint, but this is another story!) Any help would be really appreciated! Thanks!
You have to be careful with the comma, in this case “ type: "ipsum", “ Becomes: “ type: "ipsum" “