1

I have the following docs:

{
  "_id": "xyz",
  "data": {
    "cat": {
      
    },
    "exec": [
      {
        "orderNo": "2345",
        "status": "pending"
      },
      {
        "orderNo": "8907",
        "status": "Approved"
      }
    ]
  }
},
{
  "_id": "abc",
  "data": {
    "cat": {
      
    },
    "exec": [
      {
        "orderNo": "0098",
        "status": "pending"
      },
      {
        "orderNo": "3456",
        "status": "pending"
      }
    ]
  }
}

What I intend to do is write a query which would effectively identify the order based on "_id" and "orderNo" and update the "status" to 'Approved'.

Clement Amarnath
  • 5,301
  • 1
  • 21
  • 34
Prgmr
  • 129
  • 4
  • 11
  • What you have tried so far, please post that as part of the question – Clement Amarnath Nov 28 '17 at 06:25
  • Look at [this article](https://stackoverflow.com/help/how-to-ask) which has some tips on how to ask a great question that'll get you the answer you're looking for. – Abhijeetk431 Nov 28 '17 at 06:35
  • 1
    Possible duplicate of [MongoDB: How do I update a single subelement in an array, referenced by the index within the array?](https://stackoverflow.com/questions/11372065/mongodb-how-do-i-update-a-single-subelement-in-an-array-referenced-by-the-inde) – Clement Amarnath Nov 28 '17 at 06:37

0 Answers0