I'm currently having
a technical challenge that you might be able to help. I've been using the
.save() alongside @Version. I have Set, Map, and List in the POJO object.
Now I have a necessity to save every property of that collection entry, but for just one collection. For example, if user A gets a gift from user B and C while claiming gift from D concurrently, then I would like to do these operations:
1. Save everything in A and pop D from the "gifts" property. So if the gift is money, here's the query:
{"_id":"A", "version":100000000}, {"version":100000001, "money":123123, {$pop:{"gifts":"D"}}
2. Insert gift from B (no need for versioning)
{"_id":"A"}, {$push:{"gifts":"B"}}
3. Insert gift from B (no need for versioning)
{"_id":"A"}, {$push:{"gifts":"C"}}
I know I can do #2 and #3 easily, but is there a way to do #1?