在javascript中迭代List

时间:2016-06-27 10:59:45

标签: javascript strongloop

我有一个db的查询,它返回数据和对象列表。查询使用StrongLoop完成。

app.models.Individual.findById(id, {
  include: ['languages']
}, function(err, individual) {
  console.log(individual);
}

如何迭代语言列表? console.log(个人)返回此JSON

{
  firstname: 'Aarti',
  lastname: 'SHAH',
  id: 1,
  languages: 
   List [
     { name: 'English', flag: 'gb', id: 1 },
     { name: 'German', flag: 'de', id: 2 } ] 
}

我试图打印个人语言并返回

{ [Function]
  _receiver: 
   { firstname: 'Aarti',
     lastname: 'SHAH',
     id: 1,
     languages: List [ [Object], [Object] ],
  _scope: 
   { where: { individualId: 1 },
     collect: 'language',
     include: 'language' },
  _targetClass: 'Language',
  getAsync: [Function],
  build: [Function: build],
  create: [Function: bound ],
  updateAll: [Function: updateAll],
  destroyAll: [Function: destroyAll],
  findById: [Function: bound ],
  findOne: [Function: findOne],
  count: [Function: count],
  destroy: [Function: bound ],
  updateById: [Function: bound ],
  exists: [Function: bound ],
  add: [Function: bound ],
  remove: [Function: bound ] }

0 个答案:

没有答案