Can't access object property, even though it shows up in a console log

后端 未结 30 2113
日久生厌
日久生厌 2020-11-22 06:26

Below, you can see the output from these two logs. The first clearly shows the full object with the property I\'m trying to access, but on the very next line of code, I can\

30条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-22 06:56

    For me it turned out to be a Mongoose-related problem.

    I was looping over objects that I got from a Mongo query. I just had to remove:

    items = await Model.find()
    

    And replace it by:

    items = await Model.find().lean()
    

提交回复
热议问题