title: how do i get the key value instead of full object in mongoDB (node.js)
body: <p>while retrieving image name from my database, i am able to retrieve full object, but i just want the specific value.</p>
  
  <p>Example  while running the following code:</p>
  
  <pre><code>app.get("/data", function (req, res) {
    if (req.isAuthenticated()) {
  
      User.findById(req.user.id, function (err, foundUser) {
  
      Comment.find({userId:foundUser.id},{_id:0,imagename:1} ,function(err,imagename){
        if(err){
          console.log(error);
        }
        else{
          console.log(imagename);
  
          res.render("data", { EJS: a });
        }
      })
    })
    } else {
      res.redirect("/firstpage");
    }
  });
  </code></pre>
  
  <p>when I log the image name, after else above I get following output</p>
  
  <pre><code>[ 
    { imagename: 'image:image-1589817207200.PNG' },
    { imagename: 'image-1589817409060.PNG' },
    { imagename: 'image-1589817473811.jpeg' }
  ]
  </code></pre>
  
  <p>While I just want to extract the value of the image that is  (image-1589817207200.PNG' || image-1589817409060.PNG' || imagename: 'image-1589817473811.jpeg').</p>
  
  <p>I spent days searching online,and i got many answers including one on StackOverflow,that said use Object.keys(imagename),but that just logged index number ( [ '0', '1', '2' ] ) which I don't want.
  I just want the specific image name.</p>
  
  <p>Thanks in advance</p>