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

176
Visualizações
Accessing data from ORM in pug

I have a question, when I pass an Instance to the Pug file I just access the object passed as

 each row in headings
  tr
   td= row.id

while the objects is wrapped under an object itself, so how I am able to access the id just row.id and I am getting the same result with row.dataValues.id

Book {
    dataValues: {
      id: 10,
      title: 'Frankenstein',
      author: 'Mary Shelley',
      genre: 'Horror',
      year: 1818,
      createdAt: Invalid Date,
      updatedAt: Invalid Date
    },
    _previousDataValues: {
      id: 10,
      title: 'Frankenstein',
      author: 'Mary Shelley',
      genre: 'Horror',
      year: 1818,
      createdAt: Invalid Date,
      updatedAt: Invalid Date
    },
    uniqno: 1,
    _changed: Set(0) {},
    _options: {
      isNewRecord: false,
      _schema: null,
      _schemaDelimiter: '',
      raw: true,
      attributes: [Array]
    },
    isNewRecord: false
  }
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Use get({ plain: true}) method on a model instance to get a plain object.

const book = await Books.findOne({
  // options
})
const plainBook = book.get({ plain: true})
over 4 years ago · Santiago Trujillo 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