Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

292
Views
Sequelize: how to return a specific value from a field

enter image description here 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!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You have to be careful with the comma, in this case “ type: "ipsum", “ Becomes: “ type: "ipsum" “

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!