title: Delete comments inside array using index value using mongoose
body: <p>I have to delete the second comment using index value.. Following is my document structure</p>
  
  <pre><code>{
      "_id" : ObjectId("000000000fea5f24282e715b"),
      "file_name" : "resume_of_ganga_.docx",
      "created_date" : ISODate("2017-11-28T10:29:10.373Z"),
      "updated_date" : ISODate("2017-11-28T12:39:32.148Z"),
      "comments" : [ 
          {
              "created_date" : ISODate("2017-11-28T13:23:51.472Z"),
              "status" : "N",
              "comment_text" : "Yes...",
              "username" : "name"
          }, 
          {
              "created_date" : ISODate("2017-11-28T13:24:15.938Z"),
              "status" : "N",
              "comment_text" : "asdsd",
              "username" : "name"
          }
      ]
  
  }
  </code></pre>
  
  <p>I have using this following mongoose query..But my comments are not get deleting</p>
  
  <pre><code> mongo.filemanager.findOneAndUpdate({ "_id": req.body.id},{$pull : {"'comments.' +req.body.c_index" : 1 }},function(err,response){
          console.log("Deleted")
  
      });
  </code></pre>
  
  <p>For example am getting index value as 2.. It should delete the second comment... </p>
  
  <p>Thanks in Advance</p>