Categories

See More
Popular Forum

MBA (4887) B.Tech (1769) Engineering (1486) Class 12 (1030) Study Abroad (1004) Computer Science and Engineering (988) Business Management Studies (865) BBA (846) Diploma (746) CAT (651) B.Com (648) B.Sc (643) JEE Mains (618) Mechanical Engineering (574) Exam (525) India (462) Career (452) All Time Q&A (439) Mass Communication (427) BCA (417) Science (384) Computers & IT (Non-Engg) (383) Medicine & Health Sciences (381) Hotel Management (373) Civil Engineering (353) MCA (349) Tuteehub Top Questions (348) Distance (340) Colleges in India (334)
See More

Retrieve Attributes of child level object

Course Queries Syllabus Queries

Max. 2000 characters
Replies

usr_profile.png

User

( 4 months ago )


My code is as following.My objective is to retrieve first name of student from the function object given below. I did try JSON.Stringify and 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);
        }
    }
});

And here are results for console.log(item.StudentRelation); from above

{ [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

what's your interest