How to update nested sub-documents in Mongo DB
Updating sub-documents in NoSQL Mongo DB is bit trickey, so here we have come up with an solution how to update level 1 and level 2 nested subdocuments. Lets Consider below document as example: For the above document level, 1 update operation looks like below. Here we are updating forecast’s first id name from “Forecast 1” to “New Forecast 1” for this one updateOne finds works fine. as written in below code For the above document level 2 update operation looks like below. Here we are updating forecasts first id…
Read More