Wednesday 24 May 2017

How to delete nested array elements in mongo Db

"How to delete a single element from the nested array 'accounts' from the structure (Shown on the image also) of mongo db. Can I do it using $pull method? Any one know please share your Ideas".

"associatedAccounts" : [ { "organizationId" : "5808ba773fe315441b9e0a9e", "_id" : ObjectId("5808bc0c3fe315441b9e0b1a"), "accounts" : [ "5808baf33fe315441b9e0aa7", "5808baf33fe315441b9e0aa8", "5808baf33fe315441b9e0aa1" ] }, { "organizationId" : "5808ba773fe315441b9e0a9f", "_id" : ObjectId("5808bc0c3fe315441b9e0b1b"), "accounts" : [ "5808baf33fe315441b9e0aa3", "5808baf33fe315441b9e0aa2", "5808baf33fe315441b9e0aa5", "5808baf33fe315441b9e0aa6" ] } ],enter image description here



via vijesh

No comments:

Post a Comment