There is probably a way to replace that foreach loop by an aggregation pipeline instead.
The field renaming is trivial with a $project or $addFields. The rank might be a little trickier I guess there is way.
Cheers,
Maxime.
There is probably a way to replace that foreach loop by an aggregation pipeline instead.
The field renaming is trivial with a $project or $addFields. The rank might be a little trickier I guess there is way.
Cheers,
Maxime.