Wednesday 17 May 2017

How to update subdocument and delete single object of array in subdocument?

This is the object that i have:

{
  "_id": ObjectId("590985b1859aefea4a39982f"),
  "comment": [{
    "created_at": 1493880257678.0,
    "comment": "12345",
    "user_id": ObjectId("58edd98d40627c492c8689c5"),
    "_id": ObjectId("590acdc1141b16c6521b9140"),
    "modified": 1493880257678.0,
    "assigned_to": null
  }, {
    "created_at": 1493880257678.0,
    "comment": "12345",
    "user_id": ObjectId("5906c50c1be98711121edf2b"),
    "_id": ObjectId("590acdc1141b16c6521b9140"),
    "modified": 1493880257678.0,
    "assigned_to": null
  }, {
    "created_at": 1493880257678.0,
    "comment": "12345",
    "user_id": ObjectId("58edd98d40627c492c8689c5"),
    "_id": ObjectId("590acdc1141b16c6521b9140"),
    "modified": 1493880257678.0,
    "assigned_to": null
  }]
}

I want delete subdocument of comment where user_id(58edd98d40627c492c8689c5)



via Anurag Gupta

No comments:

Post a Comment