Node.js Mongoose:如何在控制台中显示混合类型对象的内容?

Node.js Mongoose:如何在控制台中显示混合类型对象的内容?,node.js,mongodb,mongoose,Node.js,Mongodb,Mongoose,使用以下数据: lines: [{ line: [12, 'Joe'] }, { line: [14, 'John'] }, { line: [6, 'Walter'] }, { line: [3, 'William'] }, { line: [18, 'Bill'] }, { line: [22, 'Albert'] }] 和模型 const Schema = mongoose.Schema; const Line = new Schema({ line: [Schema.Types.M

使用以下数据

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

const Schema = mongoose.Schema;
const Line = new Schema({
  line: [Schema.Types.Mixed]
});
const TableSchema = new mongoose.Schema({
  lines: [Line]
});
当我保存并在控制台中显示集合时,我得到: 控制台日志

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] } ],
难道不是吗

   [ { _id: '590437516c71e30ee4ddcf54', line: [12, 'Joe']
   ...
为什么内部数组对象的内容未完全显示


感谢您的反馈

对于
控制台.log()
,该对象嵌套得太深,它在引擎盖下用来检查对象。该函数的默认递归深度为2

要将深度增加到“无穷大”,可以使用以下方法:

console.log(util.inspect(data, { depth : null }));
或者,您可以使
console.log()
output JSON:

console.log('%j', data);