Is it possible to convert / use the following function in an aggregation pipeline?
int getFactor(int num1, int num2){
int temp;
while (num2 != 0){
temp = num2;
num2 = num1 % num2;
num1 = temp;
}
return num1;
}