Welcome @sohrab_shaikh ![]()
I think you need to make sure result.detections is included in the projection stage to make it accessible in the $unwind stage.
ProjectionOperation projectionPreUnwind = Aggregation.project()
.and("result.detections").as("detections");
The other thing is on your $unwind.
Now, use $unwind on detections (as it’s directly projected).
UnwindOperation unwindOpn = Aggregation.unwind("detections");
Hope this helps.