检索子级别对象的属性

我的代码如下。我的目标是从下面给出的函数对象中检索学生的名字。 我曾尝试JSON.Stringify和JSON.Parse

EnrolledSessions.find({ where: { aproval_status: 'pending', tutor_id: tutorId }, include: { relation:'StudentRelation' } }, function (err, sessions) { if (err) cb(err); if (!err) { for(var i in sessions) { var item = sessions[i]; console.log(item.StudentRelation); } } }); 

这里是console.log(item.StudentRelation); 从上面

 { [Function: bound ] getAsync: [Function: bound ] update: [Function: bound ], destroy: [Function: bound ], create: [Function: bound ], build: [Function: bound ], _targetClass: 'erudoUser' } { [Function: bound ] getAsync: [Function: bound ] update: [Function: bound ], destroy: [Function: bound ], create: [Function: bound ], build: [Function: bound ], _targetClass: 'erudoUser' } { [Function: bound ] getAsync: [Function: bound ] update: [Function: bound ], destroy: [Function: bound ], create: [Function: bound ], build: [Function: bound ], _targetClass: 'erudoUser' } { [Function: bound ] getAsync: [Function: bound ] update: [Function: bound ], destroy: [Function: bound ], create: [Function: bound ], build: [Function: bound ], _targetClass: 'erudoUser' } 

函数对象,我试图循环

 [ { coursesession_id: 574fc6baa09d9bc4050b974e, student_id: 574fbf10179281fc15c5db37, tutor_id: 574fbff2179281fc15c5db3d, aproval_status: 'pending', start_date: Thu Jun 02 2016 11:00:00 GMT+0530 (India Standard Time), duration: '06:00', session_type: 'One To One', enteredtopic_name: 'addition', payment_status: 'paid', course_completed: false, TxnId: 'IKGqrpI6IHnxIFEJsFt53EIqw', id: 574fc6baa09d9bc4050b974f, StudentRelation: { user_type: 'student', firstname: 'Student', lastname: 'Ps', active_status: true, email: 'sikha.p91@gmail.com', grade: '574fbeb2179281fc15c5db34', syllabus: '574fbea9179281fc15c5db33', mobile: '8157897518', place: 'kannru', password: '$2a$10$YIUVCclA6.vBeePZuMY7uu.6lYr..fQD4o9dSY7uF9FmgkTWAqq3i', emailVerified: true, id: 574fbf10179281fc15c5db37 } }, { coursesession_id: 574fde1dc59f447c1235007b, student_id: 574fbf10179281fc15c5db37, tutor_id: 574fbff2179281fc15c5db3d, aproval_status: 'pending', start_date: Mon Jun 13 2016 09:00:00 GMT+0530 (India Standard Time), duration: '01:00', session_type: 'One To One', enteredtopic_name: 'integration', payment_status: 'paid', course_completed: false, TxnId: 'KpDGHtLwIK6D3zIICtIGoL46p', id: 574fde1dc59f447c1235007c, StudentRelation: { user_type: 'student', firstname: 'Student', lastname: 'Ps', active_status: true, email: 'sikha.p91@gmail.com', grade: '574fbeb2179281fc15c5db34', syllabus: '574fbea9179281fc15c5db33', mobile: '8157897518', place: 'kannru', password: '$2a$10$YIUVCclA6.vBeePZuMY7uu.6lYr..fQD4o9dSY7uF9FmgkTWAqq3i', emailVerified: true, id: 574fbf10179281fc15c5db37 } }, { coursesession_id: 57511d25388d2150161559de, student_id: 574fbf10179281fc15c5db37, tutor_id: 574fbff2179281fc15c5db3d, aproval_status: 'pending', start_date: Fri Jun 03 2016 09:00:00 GMT+0530 (India Standard Time), duration: '06:00', session_type: 'One To One', enteredtopic_name: 'multiplication', payment_status: 'paid', course_completed: false, TxnId: 'voyn9oqyG14ItzzwqHI4GxM1o', id: 57511d25388d2150161559df, StudentRelation: { user_type: 'student', firstname: 'Student', lastname: 'Ps', active_status: true, email: 'sikha.p91@gmail.com', grade: '574fbeb2179281fc15c5db34', syllabus: '574fbea9179281fc15c5db33', mobile: '8157897518', place: 'kannru', password: '$2a$10$YIUVCclA6.vBeePZuMY7uu.6lYr..fQD4o9dSY7uF9FmgkTWAqq3i', emailVerified: true, id: 574fbf10179281fc15c5db37 } }, { coursesession_id: 57511d25388d2150161559de, student_id: 574fbf10179281fc15c5db37, tutor_id: 574fbff2179281fc15c5db3d, aproval_status: 'pending', start_date: Sat Jun 04 2016 09:00:00 GMT+0530 (India Standard Time), duration: '06:00', session_type: 'One To One', enteredtopic_name: 'multiplication', payment_status: 'paid', course_completed: false, TxnId: 'voyn9oqyG14ItzzwqHI4GxM1o', id: 57511d25388d2150161559e0, StudentRelation: { user_type: 'student', firstname: 'Student', lastname: 'Ps', active_status: true, email: 'sikha.p91@gmail.com', grade: '574fbeb2179281fc15c5db34', syllabus: '574fbea9179281fc15c5db33', mobile: '8157897518', place: 'kannru', password: '$2a$10$YIUVCclA6.vBeePZuMY7uu.6lYr..fQD4o9dSY7uF9FmgkTWAqq3i', emailVerified: true, id: 574fbf10179281fc15c5db37 } } ] 

       

网上收集的解决方案 "检索子级别对象的属性"