0

Hi everyone good day,

how can I get the value of this object that is returning from this

  Post.find().lean() 

  .exec((err, post) => {

    console.log(post);

    req.post = JSON.stringify(post);

    console.log(req.post);
  });

the first console log returns this

 [ { photo: [ [Object] ] } ]

the second console log returns this

 [{"photo":[{"_id":"5d7dd20185251921882e2ba1","data":"...","contentType":"image/jpeg"}]}]

now what i want to get is the contentType and data.

thank you.

1 Answer 1

2

After stringify do post = JSON.parse(post) ,then you can access post.data and post.contentType

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

2 Comments

It just returns to this [ { photo: [ [Object] ] } ] after parsing
you can access the value by looping the photo

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.