Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

177
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda