0

enter image description here

I need only path in every object in the above showing figure. I tried something like this

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' ] ]

I am getting like this. I am expecting output in array of object form

[{'1552640783_mixer front.jpg'},{......}]

Thanks in advance.

1
  • In Object the values are written as name : value pairs. I didn't get the logic behind your expecting result. Commented Mar 21, 2019 at 13:25

1 Answer 1

0

In Object the values are written as name : value pairs. Ex:

{
name : "M-DIT KOZHIKODE",
location : "Kerala",
established : 2012
}

I didn't get the logic behind your expecting result.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.