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

271
Vistas
Mongoose : How to display in the console the content of an Object typed Mixed?

with the following data :

lines: [{ line: [12, 'Joe'] }, { line: [14, 'John'] }, { line: [6, 'Walter'] }, { line: [3, 'William'] }, { line: [18, 'Bill'] }, { line: [22, 'Albert'] }]

and the Model

const Schema = mongoose.Schema;
const Line = new Schema({
  line: [Schema.Types.Mixed]
});
const TableSchema = new mongoose.Schema({
  lines: [Line]
});

when I save then display the collection in the console I get : console.log

res.body: { __v: 0,
  _id: '590437516c71e30ee4ddcf4e',
  lines: 
   [ { _id: '590437516c71e30ee4ddcf54', line: [Object] },
     { _id: '590437516c71e30ee4ddcf53', line: [Object] },
     { _id: '590437516c71e30ee4ddcf52', line: [Object] },
     { _id: '590437516c71e30ee4ddcf51', line: [Object] },
     { _id: '590437516c71e30ee4ddcf50', line: [Object] },
     { _id: '590437516c71e30ee4ddcf4f', line: [Object] } ],

should not it be ?

   [ { _id: '590437516c71e30ee4ddcf54', line: [12, 'Joe']
   ...

why the content of the inner Array Object is not fully displayed ?

thanks for feedback

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The object is too deeply nested for console.log(), which, under the hood, uses util.inspect() to inspect objects. The default recursion depth for that function is 2.

To increase the depth to "infinity", you can use this:

console.log(util.inspect(data, { depth : null }));

Alternatively, you can make console.log() output JSON:

console.log('%j', data);
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