Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

115
Views
How to get specified field data?

I'm not able to console log the specific data from a field but I'm able to console the result from an object. For example, when I console.log(enrollRegInfo), I get the data return, but when I console.log(enrollRegInfo.studentid), I get undefined

  const enrollInfo =  await Registration.findOne({_id:{"$eq": id}}) 

  const enrollRegInfo = enrollInfo.registrant.map((record) => {
        return {
          studentid: record.studentID,
          studentname: record.studentName
        };
      });

  //data returned in this line
  console.log(enrollRegInfo)

[
  {
    studentid: '6506de7b0d32492c878307a1992f54e8',
    studentname: 'Mary Jane'
  }
]

 //get undefined in this line
console.log(enrollRegInfo.studentid,enrollRegInfo.studentprincipalname)

undefined, undefined 

Thanks

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!