I am querying a mongo database using a javascript file. I have a for loop and I am adding to myArray using myArray.push(value).
My problem is when I run the script in Robomongo I get 2 outputs - the length of the array(which I don't want) and the print statements(I want).
Is there anyway to prevent the script from outputting the length of the array - is there another function I should be using other than .push???
Here is some of the script:
var myArray = [];
var result = jobData['result'];
for(var i = 0; i < result.length; i++){
var collection = result[i].Tolerances;
for(var j = 0; j < collection.length; j++){
var cur = collection[j];
myArray.push(cur); // I do not want this value outputted
}
}
for(var x = 0; x < myArray.length; x++){
var value = myArray[x];
print("Currency From: "+value.FromCurrency+";Currency To: "+value.ToCurrency+";Tolerance: "+value.TolerancePercentage+");
};
If there is more detail required just let me know.