在上面的显示图中我只需要每个对象的路径。我试过这样的事
userRouter.post('/delete_products',function(req,res){
Collections.product.find({ "_id": req.body.id }, { "pimages.path": "1" },function(err,result){
if(err)
res.send(err)
else
res.send(result)
const map=result.map(user=>user.pimages.map(user=>user.path))
console.log(map);
})
})
[ [ '1552640783_mixer front.jpg', '1552640783_mixer back.jpg' ] ]
我是这样的。我希望以对象形式的数组输出
[{'1552640783_mixer front.jpg'},{......}]
提前致谢。
在Object中,值被写为name:value对。例如:
{
name : "M-DIT KOZHIKODE",
location : "Kerala",
established : 2012
}
我没有得到你期望的结果背后的逻辑。