Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

293
Visualizações
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 Respostas
Responde à pergunta

0

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

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda