1

I have a mongoose schema which consists of an author object, content, comments, cotes, creationDate, creationIP, and creationLocation. The problem is, that if I iterate through the list returned by Application.find(), it doesn't seem to find any documents.

My code

This is inside an async () => {} function.

const applications = await Application.find(
    { _id: user.notReviewed },
    { _id: true, content: true, creationDate: true, author: true, votes: true });

console.log(applications)

for (application in applications) {
    console.log(application)
}

returns

[ { author: { username: 'Dextication', _id: '1234567890' },
    votes: [],
    creationDate: 2019-04-26T15:24:37.000Z,
    _id: 5cc321e529b4745b3474a641,
    content: 'Yeah, well that was fun!' } ]
0 // this should be the above argument in the array
Jacques Amsel
  • 1,061
  • 2
  • 14
  • 30

0 Answers0