Nodejs arr.prototype.map cannot add object properties

PageTagMapModel.getPageTagMapNum ({tag: single._id, status: "normal"}) returns the page_num
found by the mongoose query, but if three lines of comments are used in the code, there is no page_num attribute in the resulting data. You can use = to assign a value after a deep copy of single. = I don"t know why

 result = await Promise.all(result.map(async (single) => {
    // single.page_num = await PageTagMapModel.getPageTagMapNum({ tag: single._id, status: "normal" })
    // console.log(single)
    // return single
    let tag = JSON.parse(JSON.stringify(single))
    tag.page_num = await PageTagMapModel.getPageTagMapNum({ tag: single._id, status: "normal" })
    return tag
}))

because single is a document

single = single.toObject()
Menu