-
Hello everyone, i am currently having problems with my badge implementation using the ReactiveMongoCollection. I have the following database collection:
I would now like to delete all badges which have categorieId = x and subCategorieId = y and at the same time get the sum of the counts to subtract them from the globalBadges and the array-object where categorieId = x. I have found many examples for mongodb itself, but currently do not know how to implement them in java with my ReactiveMongoCollection. For example something like this which returns only the matching array-objects:
So i can iterate through the list, decrement them and then delete them... Right now i have something like this:
Thanks in advance! Luk |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
/cc @evanchooly, @loicmathieu |
Beta Was this translation helpful? Give feedback.
-
Reactive APIs aside, I'm not sure mongo's query/update facilities support what you're trying to do. You could maybe use an aggregation and merge it back to the original collection, though. |
Beta Was this translation helpful? Give feedback.
-
This is exactly where I get stuck. I don't know how to implement the aggregation i have already given above in my java. |
Beta Was this translation helpful? Give feedback.
-
Got it! Thank you guys!
|
Beta Was this translation helpful? Give feedback.
Got it! Thank you guys!