3

I have this:

{  
   "_id":"2900f1e8-48fa-418b-8e4d-73a6592e5d41",

   "CollectionRequirement":[  
      {  
         "_id":"a6af03b1-8bb3-4cb2-b307-b8831e61ef7d",
         "RequirementName":"CENTCOM14CR-000000000024243T0500089",
         "RequestorID":"IMINT ORG 1",

         "Task":[  
            {  
               "_id":"705284be-492e-4744-8361-f977b81404e9",
               "TaskPriority":"1",

               "CollectionConstraint":[  
                  {  
                     "_id":"99ec8961-647e-45db-98c3-04a91866143e",
                     "SensorID":"ASARS-2A",
                     "SensorMode":"21"
                  }
               ]
            },
            {  
               "_id":"af8c7911-0aa3-4ce2-b399-7a997ecde38a",
               "TaskPriority":"2",

               "CollectionConstraint":[  
                  {  
                     "_id":"10ec8961-647e-45db-98c3-04a918661445",
                     "SensorID":"ASARS-2A",
                     "SensorMode":"25"
                  }
               ]
            }
         ]
      }
   ]
}

I would like to add a new CollectionConstraint under Task where "TaskPriority == 1" using the C# driver. Is there a way to do this?

I saw some example code from other posts but those examples works only for a 2-level nested array. See this post for example: Insert element into nested array in Mongodb

1
  • Well, since I don't see any answer and I found something that might be useful (not exactly what I need), I'll just post it here anyway just in case people need it. pgraces.wordpress.com/2015/04/13/… Commented Apr 6, 2017 at 16:47

0

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.