I have received a MongoDB query outputting two fields (110, 1; 105, 1; 105, 2). My goal is to store these results in an array for use in a while loop:
110, 1
105, 1
105, 2
I have attempted to create a function for this task, but my array remains empty:
'otherHelperFunction': function(){
var array = {};
var finalSpielertemp = UserSpieler.find({UserID: 1}).map(function(doc) {
{$push: array{doc.SpielerID, doc.SpieltagID}};
});
}
How should I define the array correctly? It seems like using var array = {} is not the right approach. Additionally, what is the correct method for pushing elements into the array?
I would appreciate any guidance or tips on how to solve this issue. Thank you.