'Need to add method parameters with each iteration in java
In the below piece of code I need to add arguments inside fields method with each iteration.
for(int i=0; i< groups.size(); i++) {
project = Aggregates.project(fields(computed(groups.get(i), "$_id." + groups.get(i)), include("productId", "productName")));
}
i.e., in the second iteration the line of code inside for loop should be the one as below.
for(int i=0; i< groups.size(); i++) {
project = Aggregates.project(fields(computed(groups.get(i), "$_id." + groups.get(i)), computed(groups.get(i+1), "$_id." + groups.get(i+1)), include("productId", "productName")));
}
Can someone help on this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
