Updating embedded documents mongodb trans dating sites
First, increment any document that has "items.item_name" equal to "my_item_two".
Assuming you update with a single array in your query criteria, the positional operator (@zouhair The Wriite Result indicates that a matching document was not found, so you need to adjust your criteria.
Something like: Note that this will only increment the first matched subdocument in any array (so if you have another document in the array with "item_name" equal to "my_item_two", it won't get incremented). To increment the total and the price of item_three in any document that contains "my_item_three," you can use the $inc operator on multiple fields at the same time. The answer for Question#2 is perfect and works fine :) But for Question#1, the problem is you should search for the document by "user_id", and not by "items.item_name". I felt like I was making this direction apparent from the links in my answer, but I kept getting resistance saying its not what he was looking for.